12-11-2003
If you want to match the field only that contains digits only, then:
sed 's/^0[0-9]\{5\} /****** /' file1 > file2
It matchs the field starting with 0 and 5 digits follow it. I added one more space in both of pattern and replacement for more accuracy.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Can we replace the contents the of the rows of file, from one position to another position by mentioning, some start position & the width? (4 Replies)
Discussion started by: videsh77
4 Replies
2. Shell Programming and Scripting
Hi,
I have a file with data like below
a}hasksd09090}kdkdkd
aksdkdkdk787}08ksapodd
asl}alks13233}dsjskdkd
I need to replace any '}' to 0 if it appears in 10 to 15 postions.If } appears in any other postion I need to leave it.
So for the above data , output should be
a}hasksd090900kdkdkd... (1 Reply)
Discussion started by: dncs
1 Replies
3. Shell Programming and Scripting
Hi all,
I need your help.
For example I have string in file.txt:
-x -a /tmp/dbarchive_NSS_20081204 -f 900 -l 1 2008/12/04 2008/12/04
So, I need to replace symbols from (for e.g.) position 26 till 33 with symbols which I have in file replace.txt
And I have no idea how to do it.
If... (1 Reply)
Discussion started by: nypreH
1 Replies
4. Shell Programming and Scripting
I want to remove text from nth position to nth position couple of times in same line
my line is
"hello is there anyone can help me with this question"
I need like this
ello is there anyone can help me with question
'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Discussion started by: elamurugu
5 Replies
5. Shell Programming and Scripting
I'm drawing a blank on how to use sed to replace selectively based on position in the string (vs nth occurence):
hello.|there.|how.|are.|you.|
I want the period removed in the 3rd item (as defined by the pipe delimiter) if a period is present. So the result in this case would be:
... (2 Replies)
Discussion started by: tiggyboo
2 Replies
6. Shell Programming and Scripting
I asked this before, but my problem got more complicated. Heres what I am trying to do:
I'm trying to replace a string at a certain location with another string.
Heres the file I'm trying to change:
\E
I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
Discussion started by: tinman47
3 Replies
7. Shell Programming and Scripting
Hello everyone!
I'm having some problems trying to translate a text file.
I've found some TR and SED commands but doesnt work exactly as I need.
The point is:
1. Replace all the letters with accent of a text file, like this: Ã>A Á>A Õ>o
2. Replace all the special characters with a... (3 Replies)
Discussion started by: ulysses2703
3 Replies
8. Shell Programming and Scripting
hi,
can someone tell me how can I translate the following line from sed to awk?
`sed 's/^*:*:*:*:*:\(*\):.*/\1/
How to use code tags when posting data and code samples. (14 Replies)
Discussion started by: adam25bc
14 Replies
9. Shell Programming and Scripting
Hi there script guru's
I have an input file /tmp/in.txt of which the data is seperated by a : (example of the data)
test1:zz:2000:2000:zzz
te:a:2000:3333:bbb
testabs:x:2004:3000:cccc
I would like to run a scrip (bash) changing the data after the second ":"
example
Test for the value of... (3 Replies)
Discussion started by: KobusE
3 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I have never ever seen below notation for string substitution.
sed -i -e 's/tttt/pppp'/g /var/bin/czech.sh;
The strange thing for me is the position of the apostrophe. Should it be before the / or after the g?
If I had been writing that command line, I would have chosen below way:... (3 Replies)
Discussion started by: baris35
3 Replies