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...
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
All,
i would like to have a meeting reminder send me an email (to my cell phone) to remind me of meetings. I know you can set a *.wav file as a notification, but does anyone know if you can have a meeting request submit an email?
thanks
I would like to add an additional 120 meg to a filesytem. 512K block size.
chfs -a size=+???? /usr.
Can someone walk me through how to calculate the ???? I am having a hard time grasping the concept right now.
Thanks in advace.
I have created a flat file from a grep | awk statement that I am passing to a mailx statement but when the email shows up it is not displaying the new line chars. I can pass the mailx statement most other files and they show up fine. i.e. /etc/hosts. When I view the file (using vi or cat) it...
All,
I have two systems, one has the ability to access the other via .rhosts. BUT yyou have to pass the username into the access commands as we do not have access to root on the remote system. The following works just perfect:
rlogin srvr2 -l tstadm
remsh srvr2 -l tstadm 'cat /etc/hosts'...
All,
I have a simple if statement that I am trying to get to work and my quotes adn brackets are not working. I know someone will think I am struggling with a simple thing but sometimes you have ask for help
--------cut------------
if `file $file_name | grep ascii`
then
echo "ASCII"
else...
I would like to create an if statment that will evaluation if a variable contains a sequence. ie. does vairable 'var_a' contain 'abc' I am kind of confused as to how I would approace this.
Thanks
I am attempting to fire up a telnet session in the backgroud via a script. I am not needing to log into the session only to establish the session and create the telnetd process on the remote machine. REASON FOR SCRIPT - I am updating the kernel parm for the number of allowable telnet sessions...
can you run a make_tape_recovery while the systems is up, running and users are accessing data/apps? Or does it require apps to be stopped, users locked out?
thanks
I would like to create and assign a value to a variable, the name of the variable will be derived from another variable. is this possible under ksh.
Thanks
Simple one here that I have been scatching my head on. What to fire a dtterm and cat a simple flat file ito it. Each time I do it the window closes.
thanks
Mike
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.