![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to insert a string at the end of a file read | ahjiefreak | Shell Programming and Scripting | 5 | 12-10-2007 11:38 PM |
| how to insert line break + string in vi (search & replace ) | umen | Shell Programming and Scripting | 1 | 06-08-2006 12:42 PM |
| Failed to insert string into file before line | nir_s | Shell Programming and Scripting | 7 | 07-26-2005 02:37 AM |
| two lines into one colon separated line... | tonlu | Shell Programming and Scripting | 2 | 03-30-2005 11:27 AM |
| vector<string> with insert cmd | photon | High Level Programming | 1 | 09-10-2004 06:51 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Can I use sed to insert a string which has colon
Hi, all,
I wonder if I can use sed to insert a string which has a colon. I have a txt file a.txt like the following TRAIN/DR1/FCJF0/SI1027.MFC TRAIN/DR1/FCJF0/SI1657.MFC I want to insert a string C:/TIMIT/TIMIT at the begining of each line. I use the commond: TIM=C\:/TIMIT/TIMIT sed "s:^:$TIM/:" < a.txt > b.convert and I got the error "sed -e expression #1, char 7: unknow option to 's'". it seems because there is a colon in $TIM, if I use C\:/TIMIT/TIMIT instead of variable $TIM, in command sed "s:^:$TIM/:" < a.txt > b.convert it works. and I also tried sed "s:^:$*****}/:" < a.txt > b.convert still got the same problem. so I wonder how I can insert a string which has a colon in a txt file. Thanks, Jenny |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|