sed -e 's/[\!|\@|\#|\\|\$|\%|\^|\°|\&|\*|\(|\)]//g'
In that bracketed expression, every single backslash intended as an escape sequence is absolutely unnecessary. Not only are the characters following the backslashes not special when in a bracketed expresion, neither is the backslash itself.
The repeated use of | is probably intended as an alternation operation, but since the pipe symbol is not special in this context, it is unintentionally added to the list of matched characters.
The short version: There's almost nothing special within bracketed expressions, except for ], ^ (only if it occurs as the first character), and an embedded - (in the POSIX locale, used for range expressions).
Assuming I understood your intent (which is not a foregone conclusion), the following is a corrected version of what you suggested:
Regards,
Alister
I have file with are delimited by pipe(|) symbol, I wanted those to be removed except the ones which are enclosed in double quotes.
If your quote file is:
|Life is |Beautiful"|"Indeed life |is beautiful too|"|"But unix is fun| is not"|"
It should return:
Life is Beautiful"|"Indeed life is... (9 Replies)
cat file.txt
file 1123.x July 23:222 /cd/hh2/k39/ss2/f7d8d9d8e6r5t4s/dd2/e/s7a/s7a2afa5017d8b975-1.7-1395610245-b22e19bbc477b134
i wish to only extract out the 1.7 (anything within the first - -)
i try to look for the sed command under match the first occurence of pattern but out of luck, my... (6 Replies)
I have a file that looks like this:
102| #2 X 1/4-INCH| 30188| EA| FTW| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH
102| #2 X 1/4-INCH| 30188| EA| VPS| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH
102| #6 X 1/2"| ... (2 Replies)
Hi,
I am trying to remove the caret symbol from a bash variable. This is the variable:
var="GOTAN^TOK^B"and this is the code I am trying to use to remove the caret symbol:
nocarrot=`echo $var | sed -e 's/^/_/g'`This is the output intended (but not acheived with the above function):... (3 Replies)
I have a target directory, there are some files and directories in "target_dir".
I have a symbol link: my_link -> <target_dir>
The target directory name is NOT known to the script (because it is varying), while the link name is always fixed.
In a shell script, how to remove both the... (1 Reply)
Friends,
I want to remove charecters from multiple .txt files.
Foe example :
In this .txt files there are many "ctrl m" present in last of each line in one .txt file.
I want to remove "ctrl m" from each line from all .txt files.
Need your help regarding this. (4 Replies)
I want to remove the commented lines in a file identified by ' symbol at the start of each ine. A sample example will be like:
Input
-----
'IFerr_flag=0THEN
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
Output
-------... (3 Replies)
hi guys i have 6000 rows column
the text in the column has the symbol vertical bar |.
i tried some of the commands to remove it but none of the commands are reconzng this symbol. would u plz help to remove this symbol from the text with any kind of unix command
u r help would be appreciated
... (9 Replies)
Hi ,
I have this type of files:-
BGH.28OCT2008.00000001.433155.001
BGH.28OCT2008.00000002.1552361.001
BGH.28OCT2008.00000003.1438355.001
BGH.28OCT2008.00000004.1562602.001
Inside them contains the below:
5Discounts
6P150 - Max Total Usage RM150|-221.00
P150 EPP - Talktime RM150... (5 Replies)