You almost had it... You saved the pattern and replacement strings, but instead of using those saved values in your call to sed, you used $1 and $2 after shifting them away... Similarly, you used $3 instead of $FILE. The suggestion from rdrtx1 fixed the last issue, but not the first. Try:
Note that if there could be hard links to any of your $FILE operands or if the permissions on $FILE aren't the current default for newly created files, you should consider using cp instead of mv when creating your backup files (but you will need to be sure that the current permissions allow you to write the file).
The auditors have nailed us for world writeable files....
Apparently in years gone by, quite a number of our kornshell scripts have had:
umask 000 put in the script.
We have been able to turn off world writeable for existing dirs & files, but as these scripts run, new files keep getting... (1 Reply)
I want to send a single report from my application to mulitple printers with one command.
I tried using a synomym and assigning it to different printers, but it stops when it finds the first hit.
Has anyone done this at the unix level through printcap? (2 Replies)
Hi,
I would like to get 5th field from this output using FS.
Filesystem 1024-blocks Used Available Capacity Mounted on
172.29.138.222:/vol/vol0 311936256 2565248 309371008 1% /tmp/test
My command is
df -kP | awk ' BEGIN { FS="" ; } { print $5 ; } '
For some... (5 Replies)
Hi ,
I have bunch of sql file which contain UHCDEV01 in them . I want to replace all the UHCDEV01 with UHCETL01 in all the files. I have written this code which shows correct output on sh -x but doesn't change the output file .
#cat change_dbname.shl
#!/bin/ksh... (1 Reply)
Hi all,
I have mistkanely gzipped twice an entire folder and sub folders, and also renamed the files during that process.
I am trying to undo this, and I need help to create the batch to work on it.
All folders are under my images directory, I have a output.txt file that holds all the... (1 Reply)
Hi All,
I have a total of ten file to open in the Perl script and i am using a for loop to open each file and capture some strings inside each file.
Unfortunately, i encounter the below syntax error.
I think there should be something wrong with this term reports_${counting}_${_}.txt but i do... (4 Replies)
Hi, guys, I'm not a high-end programmer, but I've been trying to write a script to remove all of the b.rtbn2.cn (and b.adserv.cn and any future variation) injected script tags on the server. (Still working on security fixes to prevent it in the future, just need to clean up now.)
My approach is... (1 Reply)
I have a basic tail/grep question. I have logs that are generated & kept in a directory called alert_audit. I am using "tail" to see the logs that are coming in, but I only need logs that contain the IP address 10.249.185. or 10.247.231.
Here is the command I have, but it pulls all IP... (3 Replies)
I am using below scripts to copy all the files from multiple folders. By executing individually command i am able to copy all the files but using scripts only getting first file. System is ignoring the second CD and mget command.
HOST=server.com
USER=loginid
PASSWD="abc"
echo "open $HOST... (6 Replies)
Hi All,
I have two files in the following format.
File 1 :
1044|1|20121031|2910039.4|MR|201210|G1044|E
1082|2|20121031|1664662.84|MR|201210|G1082|E
1696|3|20121031|190801.5|MR|201210|G1696|E
1824|4|20121031|196350|MR|201210|G1824|E
1900|5|20121031|221447.8|MR|201210|G1900|E
File 2 :... (7 Replies)