remove specific characters from a string

Alex

I need to replace spaces with comma and then remove certain extra specific chars from a string.

echo "$d"
>>Mon Apr 22 05:06:00 UTC 2019
jent=$(echo $jt1 | sed 's/[[:space:]]/,/g')
echo "$jent"
>>Mon,Apr,22,05:06:00,UTC,2019 #this does the first job of replacing the space with comma

But again I want to remove the UTC part and the comma before it, how can I achieve it?

desired output should be

Mon,Apr,22,05:06:00,2019
Freddy

You can do it with one sed call, e.g.

$ echo "Mon Apr 22 05:06:00 UTC 2019" | sed 's/ \(UTC \)\?/,/g'
Mon,Apr,22,05:06:00,2019

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Remove specific characters from a string

From Dev

Remove specific characters from a string

From Dev

Remove the last X specific characters from string

From Java

Remove specific characters from a string in Python

From Dev

Awk to remove characters from start of string in specific column

From Dev

How to remove all characters from a string before a specific character

From Dev

Remove characters from specific length

From Dev

remove characters from a python string

From Dev

Remove characters from String in Haskell

From Dev

Remove characters from query string

From Dev

Remove characters from a string then reverse it

From Dev

Remove certain characters from string

From Dev

Remove repeating characters from string

From Dev

Remove characters from string with sed

From Dev

Remove all characters from the string

From Dev

Remove nonalphabet characters from a string

From Dev

Remove characters from a string sql

From Dev

Attempting to remove characters from a string

From Dev

Remove last characters from string

From Dev

Remove Invalid Characters from string

From Dev

Removing specific characters from a string

From Dev

Remove text that is between two specific characters of a string

From Dev

Remove characters in string before specific symbol(including it)

From Dev

How to remove sub string or specific set of characters from a string using Jquery or JS.?

From Dev

bash : Remove the specific pattern of characters from a line

From Dev

Remove empty string characters from a javascript string

From Dev

Remove string characters from a string if not matched in an array

From Dev

Remove string characters from a string if not matched in an array

From Dev

Remove specific char from String

Related Related

HotTag

Archive