sed replace not work Pls. help me


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed replace not work Pls. help me
# 1  
Old 09-20-2010
Hammer & Screwdriver sed replace not work Pls. help me

sed replace not work Pls. help me

I used sed command in my file
Code:
66875964560@1982589             90825890001@90825890001@3@15/12/2007 14:25:14@22/03/2010 6:06:13@20/01/2010 3:28:39
66873064490@1925912             90259120001@90259120001@5@02/04/2009 1:51:31@30/10/2009 3:08:34@13/09/2009 8:24:33
66851682693@1982589             90825890001@90825890001@3@15/12/2007 14:05:43@23/05/2010 5:20:39@15/04/2010 3:07:33
66836281161@1982545             90825970001@90825970001@3@27/02/2008 12:00:17@14/08/2009 10:25:01@06/08/2009 3:14:48
66894080622@1982589             90825890001@90825890001@3@15/12/2007 15:35:02@02/10/2009 17:25:01@21/09/2009 3:17:53
66873521161@1982589             90825890001@90825890001@3@15/12/2007 14:22:38@22/07/2009 18:22:05@23/06/2009 2:55:06
66873858124@1982589             90825890001@90825890001@3@15/12/2007 22:45:50@25/11/2008 4:17:27@29/09/2008 4:52:01
66869840940@1982545             90825970001@90825970001@2@19/02/2008 19:48:13@26/09/2010 3:35:36@27/08/2010 3:35:36
66816414077@1982545             90825970001@90825970001@2@01/09/2007 10:32:47@09/10/2010 3:51:30@09/09/2010 3:51:30
66875191279@1982589             90825890001@90825890001@3@15/12/2007 22:40:25@26/10/2008 3:53:01@29/08/2008 16:25:09
66869885838@1982590             90825970008@90825970008@3@25/09/2009 10:36:56@26/09/2009 21:25:11@25/05/2009 22:28:11
66874122273@1982590             90825970008@90825970008@3@15/03/2009 18:02:47@24/04/2009 21:51:04@31/03/2009 3:26:37

i use command ::
Code:
 sed 's/             /@/g'  myfile

but not work

i want to out put
Code:
66875964560@1982589@90825890001@90825890001@3@15/12/2007 14:25:14@22/03/2010 6:06:13@20/01/2010 3:28:39
66873064490@1925912@90259120001@90259120001@5@02/04/2009 1:51:31@30/10/2009 3:08:34@13/09/2009 8:24:33
66851682693@1982589@90825890001@90825890001@3@15/12/2007 14:05:43@23/05/2010 5:20:39@15/04/2010 3:07:33
66836281161@1982545@90825970001@90825970001@3@27/02/2008 12:00:17@14/08/2009 10:25:01@06/08/2009 3:14:48
66894080622@1982589@90825890001@90825890001@3@15/12/2007 15:35:02@02/10/2009 17:25:01@21/09/2009 3:17:53
66873521161@1982589@90825890001@90825890001@3@15/12/2007 14:22:38@22/07/2009 18:22:05@23/06/2009 2:55:06
66873858124@1982589@90825890001@90825890001@3@15/12/2007 22:45:50@25/11/2008 4:17:27@29/09/2008 4:52:01
66869840940@1982545@90825970001@90825970001@2@19/02/2008 19:48:13@26/09/2010 3:35:36@27/08/2010 3:35:36
66816414077@1982545@90825970001@90825970001@2@01/09/2007 10:32:47@09/10/2010 3:51:30@09/09/2010 3:51:30
66875191279@1982589@90825890001@90825890001@3@15/12/2007 22:40:25@26/10/2008 3:53:01@29/08/2008 16:25:09
66869885838@1982590@90825970008@90825970008@3@25/09/2009 10:36:56@26/09/2009 21:25:11@25/05/2009 22:28:11
66874122273@1982590@90825970008@90825970008@3@15/03/2009 18:02:47@24/04/2009 21:51:04@31/03/2009 3:26:37



How to get it ?
Can anybody help me out?

Thanks,
Oillie
# 2  
Old 09-20-2010
Its working fine at my end , post the output after running sed command.
# 3  
Old 09-20-2010
Code:
$ ruby -ne 'print if gsub(/\s{2,}/,"@")' file
66875964560@1982589@90825890001@90825890001@3@15/12/2007 14:25:14@22/03/2010 6:06:13@20/01/2010 3:28:39
66873064490@1925912@90259120001@90259120001@5@02/04/2009 1:51:31@30/10/2009 3:08:34@13/09/2009 8:24:33
66851682693@1982589@90825890001@90825890001@3@15/12/2007 14:05:43@23/05/2010 5:20:39@15/04/2010 3:07:33
66836281161@1982545@90825970001@90825970001@3@27/02/2008 12:00:17@14/08/2009 10:25:01@06/08/2009 3:14:48
66894080622@1982589@90825890001@90825890001@3@15/12/2007 15:35:02@02/10/2009 17:25:01@21/09/2009 3:17:53
66873521161@1982589@90825890001@90825890001@3@15/12/2007 14:22:38@22/07/2009 18:22:05@23/06/2009 2:55:06
66873858124@1982589@90825890001@90825890001@3@15/12/2007 22:45:50@25/11/2008 4:17:27@29/09/2008 4:52:01
66869840940@1982545@90825970001@90825970001@2@19/02/2008 19:48:13@26/09/2010 3:35:36@27/08/2010 3:35:36
66816414077@1982545@90825970001@90825970001@2@01/09/2007 10:32:47@09/10/2010 3:51:30@09/09/2010 3:51:30
66875191279@1982589@90825890001@90825890001@3@15/12/2007 22:40:25@26/10/2008 3:53:01@29/08/2008 16:25:09
66869885838@1982590@90825970008@90825970008@3@25/09/2009 10:36:56@26/09/2009 21:25:11@25/05/2009 22:28:11
66874122273@1982590@90825970008@90825970008@3@15/03/2009 18:02:47@24/04/2009 21:51:04@31/03/2009 3:26:37

# 4  
Old 09-20-2010
u can try this
Code:
sed 's/  */@/'  myfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Centos server, had to replace the motherboard now the embedded NICs don't work

Basically what the title says. Had to replace the motherboard on an HP DL380 G6 today, of course now the embedded NICs don't work because the ifcfg-eth files have the MAC addresses for the embedded NICs from the old machine. How can I find the new/correct MAC addresses so I can edit the... (2 Replies)
Discussion started by: xdawg
2 Replies

2. UNIX for Dummies Questions & Answers

Why does this SED example work?

$ x="/home/guru/temp/f1.txt" $ echo $x | sed 's^.*/^^' This will give the absolute path f1.txt. I don't understand WHY it works. How is it determining the last "/" character exactly? (7 Replies)
Discussion started by: glev2005
7 Replies

3. Shell Programming and Scripting

Replace string with sed doesn't work

Hello, Unfortunately I don't found any working solution for my problem :/ I have pass file for dovecot authorizing in this format: user@domain.tld:{SSHA}Ykx2KVG/a2FKzjnctFFC2qFnrk9nvRmW:5000:5000:::: . . ...Now, I want to write some sh script for password changing for grep'ed user, in... (5 Replies)
Discussion started by: vincenty
5 Replies

4. Shell Programming and Scripting

Some sed help pls

Hello, I have made a list of files of which I want to remove strings beginning with <iframe and </iframe When I run the script I see the files fly along and the strings being removed. However, in the source files nothing has changed. Do I really need to write sed's result to a different... (3 Replies)
Discussion started by: algernonz
3 Replies

5. Shell Programming and Scripting

Does Sed Search/Replace Work For Multiple Matches On The Same Line?

Hello, I would like to delete all the footnotes in all my htm files. Hence, I have to delete the whole font tag pairs, i.e. deleting everything between the begin/end font tags. I create a testfile, of which data parts of all four lines are the same except for the number of font tag pairs,... (3 Replies)
Discussion started by: cibalo
3 Replies

6. Shell Programming and Scripting

SED - replace with new line didn´t work for solaris

Hi This is what I was trying to do, comment one line and add something different in a new line right next. This is the command I want to do more .profile | sed 's,STRING1, #STRING1 NEWLINE STRING2,' (I´m using ',' because my string is something like this exec... (3 Replies)
Discussion started by: alcalina
3 Replies

7. Shell Programming and Scripting

pls help! complex find and replace

help pls... i would like to change this CURVE2 565489 789458 1258649 random data here... CURVE2 565489 568795 6548921 random data here... CURVE2 565489 123598 6446259 random data here... CURVE2 565489 672956 2489657 into this CURVE2 565489 586423 1258649 random data here...... (2 Replies)
Discussion started by: lakanino
2 Replies

8. Shell Programming and Scripting

My script does not work - could you pls help?

Hi all, I put together a script that seems not working as I would like to and after spending hours to find the problem I decided to ask your help. The thing I am trying to do is call AWK command on the TRUE branch of if statement. Else branch should only print out a message to screen. This... (1 Reply)
Discussion started by: BearCheese
1 Replies

9. Shell Programming and Scripting

tricky search replace: Pls help.

Hi, I have a a mysql dump text file. I need to replace the below line ------------------------------------------------------------------- ) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1; ------------------------------------------------------------------- with this text ... (5 Replies)
Discussion started by: vaibhavs
5 Replies

10. Shell Programming and Scripting

replace word with using "sed" not work...

Hi, I have a xml text file with the following data, I would like replace F0</Number> to F</Number> only. i used sed to replace, but it not work!! anyone can help? <Number>11 20 03 22 23 21 91 00 F0</Number> <Number>12 20 03 20 99 21 91 20 F0</Number> <Number>10 21 03 21 78 21 92 27... (28 Replies)
Discussion started by: happyv
28 Replies
Login or Register to Ask a Question