![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to search and replace text in same file | Vrgurav | Shell Programming and Scripting | 1 | 04-25-2008 03:20 AM |
| how to replace one line in text with several lines | FunnyCats | UNIX for Dummies Questions & Answers | 1 | 01-18-2007 06:52 AM |
| script - replace text in file | frustrated1 | Shell Programming and Scripting | 4 | 01-01-2006 11:10 PM |
| Search and replace multi-line text in files | marz | Shell Programming and Scripting | 10 | 10-10-2005 05:05 AM |
| replace text in a file from the command line... | dudboy | UNIX for Dummies Questions & Answers | 1 | 09-04-2001 11:31 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need to change the first line a file from
"HDR,{any_number}",,,,, where {any_number} is incremental for each file to HDR,{any_number} Can someone please suggest an easy way please Regards Col
__________________
Col Chase |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I don't understand exactly what you want to do. Could you post an example or two?
|
|
#3
|
||||
|
||||
|
In the example I'm giving, I tested it with a text file name "file". You may need to rework this a little, but I think it might fit your needs:
cat file "HDR,56",,,,, "HDR,31",,,,,, "HDR,66",,,,, "HDR,59",,,,, sed -e 's/\"//g' file | cut -d, -f1-2 HDR,56 HDR,31 HDR,66 HDR,59 If you need to, you can redirect the output to a different file. |
|
#4
|
|||
|
|||
|
Cheers LivinFree
Your advise was correct and it now works a treat
__________________
Col Chase |
|||
| Google The UNIX and Linux Forums |