10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm working on a script to execute a number of items. One being, editing particular files to add certain lines. I'm attempting to utilize sed, but, having issues when running from a bash script. Assistance is greatly appreciated.
My example:
sed -i '14 i\
# add these lines
add these lines to... (5 Replies)
Discussion started by: Nvizn
5 Replies
2. UNIX for Dummies Questions & Answers
Hi Everyone,
I have edited my cron using 'crontab -e'. When I try to save the changes using ':wq!' The file closes but the changes are not saved. I get the following messages:
"/tmp/crontabJFainH" 45 lines, 2996 characters
trail.log
crontab: error on previous line; unexpected character found... (11 Replies)
Discussion started by: Scarlet
11 Replies
3. Shell Programming and Scripting
Hi guys, I am currently using this to save first 50 lines into top50.txt and delete them from list.txt ... it's 2 commands:
head -n 50 list.txt > top50.txt && sed -i "1,50 d" list.txt
I want to change that so it's 1 command - whereby sed removes the first 50 lines as above but that which is... (3 Replies)
Discussion started by: holyearth
3 Replies
4. Shell Programming and Scripting
hi,
Im trying to do a sed and save it in teh same file using sed -i option
But i think my system doesnt supports that option at all. BTW, im working in ksh.
Is there any alternate for this?
Thanks (3 Replies)
Discussion started by: dvah
3 Replies
5. Shell Programming and Scripting
I have got problems saving sed changes to the same file in a loop.
Basically I want the delimited value in every line of the file to be set to blank according to the value stored in var. var can be changed anytime.
I do not have sed -i and i've tried to mv the file. Any other ideas?
My file... (8 Replies)
Discussion started by: alienated
8 Replies
6. Shell Programming and Scripting
What is an efficient way to remove all lines from the input file which contain a file name?
inputfile:
=======================
# comment
# comment
# comment
5 8 10 /tmp
5 8 10 /var/run
5 8 10 /etc/vfstab
5 8 9 /var/tmp
5 8 10 /var/adm/messages... (7 Replies)
Discussion started by: Arsenalman
7 Replies
7. Shell Programming and Scripting
I have the follwoing file:
This looks to be : seperated.
For the first field i want only the file name without ".txt" and also i want to remove "+" sign if the second field starts with "+" sign.
Input file:
Output file:
Appreciate your help (9 Replies)
Discussion started by: pinnacle
9 Replies
8. Shell Programming and Scripting
Hi All,
I want to edit a file using shell script..For ex...a file called /etc/passwd..here I am searching for "ftp" if it is there just change it to "tftp" without using any temporary file. (3 Replies)
Discussion started by: Vichu
3 Replies
9. Shell Programming and Scripting
I have an xml file that gets created as a part of daily build. I have to modify some lines in this file, uncomment some lines, comment some line, add 2 new lines in the file every time.
Is there an easier automated way to do this using perl, bash, or sh. I would appreciate it if someone can point... (1 Reply)
Discussion started by: saurabh1982
1 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I generally use Perl for this
ex.
perl -e 's/pattern/replace/g' -p -i <filename>
I did something like this..
find . -type f -exec perl -e 's/pattern/replace/g' -p -i {} \;
I want to do this with "sed"
but what I get is the output being printed on the screen..
i can do sed... (3 Replies)
Discussion started by: oldtrash
3 Replies