Hi,
I have a normal txt file which contains say 5 lines. in that i need to change few of the the parameters dynamically.
for eg..
line 1..contains account
line 2 contains date
line 3 contains user
..
..
..
i will be taking the input using read command and store it in variables account,date and user variables..
but now.. how will i capture that in the txt file..
Pls help.
Thanks
anbu23
2
read account
read date
sed -e "1 s/^.*$/$account/" -e "2 s/^.*$/$date/" file > temp
mv temp file
Similarly add commands in sed to change other lines.
sorry .. i didnt mention one thing..
How to read from the file.. or how to store the contents of a file using script.
i mean.. I have a file called total.txt and i want to take some data from the file to do some manipulations..
is this the right command..
a << total.txt
anbu23
4
If you the know line numbers of the required lines then try this
a=$( sed -n "3,10 p" total.txt )
Retrieve text from third to tenth line.