![]() |
|
|
|
|
|||||||
| 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 |
| CLI Magic: Using GNOMEvfs to manipulate files | iBot | UNIX and Linux RSS News | 0 | 04-08-2008 01:50 AM |
| Manipulate files | tonet | Shell Programming and Scripting | 0 | 09-26-2007 01:04 AM |
| Treating bzip2 files as text files | ShawnMilo | Shell Programming and Scripting | 1 | 06-15-2007 10:16 AM |
| text files, ASCII files, binary files and ftp transfers | Perderabo | Answers to Frequently Asked Questions | 0 | 04-08-2004 01:25 PM |
| grep multiple text files in folder into 1 text file? | coppertone | UNIX for Dummies Questions & Answers | 7 | 08-23-2002 11:50 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
using sed to manipulate text in files
Hi, I have a slight problem in trying to manipulate the text within a file using the "sed" command in that the text i need changed has "/" slashes in.
I have a .sh script that scans the "/db/sybbackup/" directories for any .dmp file older than 2 days and then to >> the information to a file called "removeold.txt". Essencially the text in the file is shown in below in blue. /db/sybbackup/databases/ENT_IO_20080101.dmp I have tried the following using the sed command 1. sed 's/{/db/sybbackup}/{rm /db/sybbackup}/' removeold.txt >> rmscript.sh 2. PATH="/db/sybbackup/" REPPATH="rm /db/sybbackup" sed 's/${PATH}/${REPPATH}/' removeold.txt >> rmscript.sh I am hoping to get the following end result using "sed" and not to use "nawk". mind you, i have only been working on Solaris now for a week and am still waiting for my training rm /db/sybbackup/databases/ENT_IO_20080101.dmp Can anyone please point me in the right direction to get past the "/" problem in "sed" |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Ok, sorted it out, I just replaced the "/" with a "!"
sed 's/{/db/sybbackup/}{rm /db/sybbackup}/' removeold.txt >> rmscript sed 's!/db/sybbackup!rm /db/sybbackup!' removeold.txt >> rmscript Suppose i just needed to talk myself thru this :-) |
|
#3
|
||||
|
||||
|
Hi.
Quote:
Quote:
|
|
#4
|
|||
|
|||
|
Quote:
|
|||
| Google The UNIX and Linux Forums |
| Tags |
| debug, problem-solving |
| Thread Tools | |
| Display Modes | |
|
|