I am looking to insert a line of text in a file after a specific line. I know how to do it based on the line number:
#perl -pi -le 'print "New line Insertion" if $. == 100' file.txt
How would i adjust the example above for inserting "New Line Insertion" on the line after my search pattern...
Thanks,
I acutally have this one bookmarked along side my Awk one liners and Perl one liners. I just can't seem to solve this "simple looking" problem.
All,
I am looking for a one-liner to insert text into an ascii file above a line that matches a search.
Example.
I would like to insert a line of text above the line End_of_Section in a file.
Before:
file_a
-------
Start_of_Section
mike
julie
spencer
End_of_Section
After:
file_a
-------...
I am looking for sed command to remove the last comma from a given file. regardless of what line or position.
Any help would be greatly appreciated.
Simpson
I would like to use an awk statement to do the follow. Search for a specific line in a file that contains a word and print out the 5th item.
Easy enough. awk '/foo/ {print $5}' /tmp/log
what I would like to do is take it one step further and truncate the result down because the data is...
Hello,
I have a (KSH) script taht interprets different input squences and processes them. The first of which is a CSV so I have set IFS to , with:
IFS=,
Now later in my script I am reading input in from a grep command and would liek to |read var1 var2 var3 ....
How do I set my IFS back to...
I am attempting to cut the first part of a filename out of a variable.
Filename - servername20090201.csv
servername - all characters until 200
what I am attempting to do is this
---------------
i=servername20090201.csv
echo $i | cut -f1 -d"200"
---------------
Obviously this isn't working...
All,
I would like to email a txt file from the command line as an attachement rather than the txt file being the body of the message.
example. mailx -s "Test Email" anyone@something.com < /tmp/text_file.txt
this just puts the context of /tmp/text_file.txt in the body. I want it to be...
I would like to find a command(s) that will allow me to get more information around an open socket connection. Capture open port information, close open ports and restart port without having to reboot.
Any ideas?
Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.