![]() |
|
|
|
|
|||||||
| 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 |
| Searching all files that contain pattern | ravi.sadani19 | Shell Programming and Scripting | 4 | 5 Days Ago 03:52 PM |
| Pattern searching pattern in c files | murthybptl | Shell Programming and Scripting | 6 | 11-17-2007 06:15 AM |
| Regarding Searching Pattern | sbasetty | Shell Programming and Scripting | 2 | 09-29-2006 02:49 PM |
| Searching for a pattern in a Directory | gandhevinod | Filesystems, Disks and Memory | 1 | 02-25-2005 05:35 AM |
| pattern searching using C | giannicello | High Level Programming | 1 | 04-16-2002 09:53 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to use cat command in sed pattern searching
Hi All,
I have a file named pattern.dat which contains pattern like A1000090 250.00 250.00 i have one more file named test.dat in which this pattern is present. What i should do is, in test.dat after this pattern i should append comments. i used like this sed "/`cat pattern.dat`/ a\ > COMMENT > " test.dat It is throwing error as sed: command garbled: /A1000090 250.00 250.00 / COMMENT please help me out to solve this probelm. Thanks, Sona. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Dear Sona,
The error you are getting is probably because you are using "" on place of ''. You can try this also.....it's little ugly but I think it might solve your purpose..... sed '/[a-zA-Z0-9]* [0-9]*\.[0-9]* [0-9]*\.[0-9]*/ a\ COMMENT ' pattern.dat > test.dat regards Apoorva kumar |
|
#3
|
|||
|
|||
|
Hi Apoorva,
I think u misunderstood my query... I just want to search the pattern(present in pattern.dat) in test.dat and append a new line after that pattern in test.dat. I tried with ur code..it is not working. Thanks, Sona. |
|
#4
|
|||
|
|||
|
Ok ! Let me check it!!
regards Apoorva kumar |
|
#5
|
|||
|
|||
|
But the pattern should be taken from one file.It is not just any string we can use. so how can i do that?
how can i take the pattern from one file and check it in another file using sed since i need to append the comment text after that pattern. Sona. |
|||
| Google The UNIX and Linux Forums |