No. The grep utility searches for lines matching a regular expression, it does not change/replace text on matched lines.
Try:
If it isn't obvious, the 1st part of the sed substitute command contains a literal tab character, not spaces (<s></><tab><minus-sign><dollar-sign></>...).
Or to make Makarand Dodmis' awk script work, you could try:
Note that if you try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk.
This User Gave Thanks to Don Cragun For This Post:
here's what im trying to do.
i have a file containing lines similar to this:
data.txt:
1hsRmRsbHRiSFZNTTA1dlEyMWFkbU5wUW5CSlIyeDFTVU5SYjJOSFRuWmpia0ZuWXpKV2FHTnRU
1lKUnpWMldrZFZaMG95V25oYQpSelEyWTBka2QyRklhSHBrUjA1b1kwUkJkd3BOVXpWM1lVaG5k... (5 Replies)
I have been having an encoding problem that I need to solve.
I have an 4-column tab-separated file: I need to remove all of the lines that contain the string 'vis-à-vis'
achiever-n vis-à-vis+ns-j+vp oppose-v 1
achiever-n vis-à-vis+ns-the+vg assess-v 1
administrator-n ... (4 Replies)
Hi Gurus,
when I run following command to split one line file to multiple lines, it stopped because of hitting un-printable special charactor.
awk -v L="$2" '{for (i=1; i<=length($0); i+=L) print substr($0, i, L)}' "$1" > "$1"_split
I use cat -A, I can see one un-printable charactor M-^T.
how... (1 Reply)
Hi,
I have a file with lines like below.
I need to remove first few characters from each line until a date format is found.
05/06/12 20:47:02 GUMGUY@98.192.174.74{42B42A72AC955F5926621273E3A15059.tomcat2}TP-Processor15 LogExchUsage: ERROR:
05/06/12 20:47:02... (8 Replies)
I have a file with all kinds of ^M at the end of each line. How the heck can these be removed? I tried a global search and replace, but it doesn't seem to work.
Thanks! (8 Replies)
Hi please help in writing a script for replacing all the non-iso8859-1 characters to question marks.
I need a pattern of this kind
"sed s/<non-iso char range>/?/g < ipfile > opfile"
Please help me in this. (2 Replies)
Here is my problem.
I have a list of phone numbers that I want to use only the last 4 digits as PINs for something I am working on. I have all the numbers in a file but now I want to be removed all items EXCEPT the last 4 digits.
I have seen sed commands and some grep commands but I am... (10 Replies)
hi
i have a file with these strings:
123_abc_X1116990
how to get rid of 123_abc_ and keep only X1116990?
I have columns of these:
123_abc_X1134640
123_dfg_X1100237
123_tyu_X1103112
123_tyui_X1116990
thx (5 Replies)
Hi,
I am having a file which contains records as follows:
DETAIL_KEY~12344|ACTIVE_PASSIVE~Y|AVG_SIZE_OF_RESPONSE~123123131
DETAIL_KEY~12344|ACTIVE_PASSIVE~Y|AVG_SIZE_OF_RESPONSE~123123131
DETAIL_KEY~12344|ACTIVE_PASSIVE~Y|AVG_SIZE_OF_RESPONSE~123123131... (4 Replies)