The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-14-2009
palanisvr palanisvr is offline
Registered User
  
 

Join Date: Mar 2007
Location: India
Posts: 16
cat <<EOF >mfile
#!/bin/ksh
echo "hello world"
EOF

I have 2 questions

1. now i would like to add a second line after the first echo command
e.g. echo "this is line 2"

how can i do that ?

Solution :

append the new line to the exist data in the file by using :
Code:
$ echo "this is line 2" >>mfile

This will append the "this is line 2" to the existing data in the file .

2. I would then like to delete the first line
echo "hello world"

Solution :

open the file using vi

$vi mfile

step 1 : now go to ex mode by clicking ":"

then type 1d

this will delete the first line from the script
or else
u can use standard commands to achieve the same

Last edited by Yogesh Sawant; 03-31-2009 at 02:46 PM..