|
How to insert text in the middle of a file w/o SED or AWK!!
tht dint wrk as i am trying to do this using a script..im pasting the script
#!bin/bash
echo "Enter a line of text";
read text;
echo "Enter the file path to append to";
read path;
nfline=$(wc -l $path);
middle=$($nfline/2);
head -$middle $path > tmpfile;
$text >> tmpfile;
tail -$middle $path >> tmpfile;
mv tmpfile $path;
more $path;
Last edited by kartikkumar84@g; 05-09-2008 at 06:06 PM.
|