Replace command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Replace command
# 1  
Old 03-04-2013
Replace command

Hi ,

I have a sequence which looks like this

Lsat01000001
Lsat01000002
Lsat01000003
..
Lsat01000999
..
Lsat01100001
Lsat01278544

i want my output to look like this:

seq1
seq2
seq3
...
seq999
....
seq100001
....
seq278544

I used command but my output turned out as this:
sed 's/Lsat01/seq/g' filename >sortedfile

seq000001
seq000002
seq000003
...
seq000999
....

seq100001
....
seq278544

How can I get rid of additional zeroes

For example in seq 1, it shows as seq0000001 .


Please do advise.
# 2  
Old 03-04-2013
Code:
s/Lsat010*/seq/

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed Command to replace particular value.

Hi , My input file contain : list = 3 14 15 10 9 11 12 18 19 20 21 22 23 24 25 26 6 1 2 3 4 5 7 8 16 17 27 28 30 29 Expected output : list = 0 0 0 0 0 0 0 18 0 20 0 0 0 0 0 0 6 0 0 3 4 0 0 0 0 0 0 0 0 0 I want to keep the 8,10,16,17,22 value from the list and put 0 on rest of the... (9 Replies)
Discussion started by: Preeti Chandra
9 Replies

2. Shell Programming and Scripting

sed replace command

Hi. I need to append/prefix an & character to every 'single' & character (not when there are 2 or more grouped together) I find in a file. I can do it using this cmd: cat ${file} | sed -e 's/&/&&/g' > ${new_file} How can I modify this to ensure I only replace single &'s and not operate... (11 Replies)
Discussion started by: user052009
11 Replies

3. UNIX for Dummies Questions & Answers

Global replace command help

Hello - I am trying to use a global replace command but its not working. Here is the cmd I am using in vi: :%s/OLD/NEW/g However, in my "NEW" I already have a "/" which is not making the replace work: :%s/mytestscript.com:33232/mytestscript:70245/test.com/g the... (2 Replies)
Discussion started by: DallasT
2 Replies

4. Shell Programming and Scripting

Please help replace character command

hi i have log : i want remove some char become like this: anybody can help me ? (7 Replies)
Discussion started by: justbow
7 Replies

5. Shell Programming and Scripting

find and replace command

Hi, i used to do on soalris box but in linux box i am not able to do advice is appreciated uname -a Linux intranet 2.4.20-pre3 #1 Tue May 6 17:55:35 IST 2008 i686 unknown $ find /usr/local/ -type f | xargs perl -pi -e 's/172.16.1.14/172.16.1.27/g' Can't remove /usr/local/bin/dbhome:... (1 Reply)
Discussion started by: prakash.gr
1 Replies

6. Shell Programming and Scripting

problem with replace command with tr

I have a sample file like this 7829885 7831552 + 1 1667, 0, 35934936 35937087 - 2 1281,870, 0,1281, I would like to replace values starts with comma with just value like 0, to 0 or 1667, to 1667. I can do with this by using tr -d '0,' '0' <file But the... (2 Replies)
Discussion started by: repinementer
2 Replies

7. UNIX for Dummies Questions & Answers

find and replace command in one line using one command

Hi, I have a entry in the file as ::BSNL GUJARAT::India::OUT::NAT::REWEL::POSTPAID::919426199995 if u see this, i have the delimiter as :: , all i want is to replace "::" as ":" so how to do that.. pls help thanks (10 Replies)
Discussion started by: vasikaran
10 Replies

8. Shell Programming and Scripting

How I can replace this command --need help

Hi, can I delate first line in a file without opening a file. Normal unix "sed -i '1d' $path/cash.log" command is working fine, but my windows application not supporting latest version of sed, I also tried to download latest version of sed.exe but failed to find one. I am in a process of... (10 Replies)
Discussion started by: sudhish
10 Replies

9. UNIX for Dummies Questions & Answers

vi command - replace

Hi, Given a long text file. How can I replace all full stops- with semicolon thanks, tictactoe (1 Reply)
Discussion started by: tictactoe
1 Replies

10. UNIX for Dummies Questions & Answers

Command to replace character

I've been googling for the following for the past few weeks several times, but haven't yet come across something that I could easily grasp. Can someone point me in the right direction please? I'm trying to replace a character in file names, i.e. the character is a period, and I want to replace... (5 Replies)
Discussion started by: HLee1981
5 Replies
Login or Register to Ask a Question