Hi this is quite simple i am sure but without using awk or sed i need to add text to the top of a file this is what i have got so far
#!bin/bash
echo "Add text to top of file"
read line
echo $line >> file1
This adds the text to the bottom of the file can some1 please help cheers (7 Replies)
when directing some text into a file can you choose where it goes like the top of the file (which is text aswell) or the middle??
if so how - especially would like to know how to do so in vi (text editor)
If i were to enter an argument ($1) into a another argument ($2)
would it would be... (6 Replies)
Dear All,
I have two files
One is script file in which I am writing commands to append a text in a normal file.
I want to insert the text on top of the file.
I dont want to use sed and awk commands nor temp file.
is it possible? (3 Replies)
Dear Folks :),
I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp.
I can do this in vi editor by using this command :g/^/s//BBB_
e,g I have a file named as Test.dat and it containins below text:
michal... (4 Replies)
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
say I want to insert "this is a test" as the first line into file A, besides
echo "this is a test" > /tmp/tmpfile
cat /tmp/tmpfile fileA >> /tmp/result,
is there any simple way I can do it? thanks (7 Replies)
Hi,
I have a single value in insertval file. I want to load that value to database with the current date. I tried the below code but it is inserting <NULL> to database and echo $c is also null.
cat insertval | awk -F ' ' '{print $1}' > c
echo c=$c
data=`sqlplus -s user/pwd@hostname <<EOF ... (5 Replies)
I'm trying to take mrt output and put it at the top of a file along with the date and time. I was able to do it at the bottom of the file with the following
printf "********** $(date) **********\n\n" >> $OUTPUT_PATH/$HOSTNAME
mtr -r -w -c 10 $HOSTADDRESS >> $OUTPUT_PATH/$HOSTNAME
printf... (2 Replies)