want to add a string in a very top of a file without using VI or SED or AWK
this is what ive done:
(echo '0a'; echo 'LINE OF TEXT'; echo '.'; echo 'wq') | ed -s myfile
to add astrng right in the middle i could have count the lines of the file and just chenge the address.
EG. if file has 6 lines of text:
(echo '3a'; etc...etc...etc ...)...
User Profile
Collapse
-
add a string in the middle of a file
-
This is what i mean...
Look at this please!!!
[ciro.ruggiero@u nix ~]$ grep $USER xx | cat -n
1 USER=ciro.ruggi ero
2 MAIL=/var/spool/mail/ciro.ruggiero
3 PATH=/u01/app/oracle/product/10.2.0/db_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/ciro.ruggiero/bin
4 PWD=/home/ciro.ruggiero
5 HOME=/home/ciro.ruggiero
6 LOGNAME=ciro.ru ggiero... -
search for occurrences
i ve got a file with 100 of text lines and many occurrences.
How can i search and display them all nummbered?
E,g:
1) bla bla bla
2) fortij nfhru
3)fhdgfhdiwe
P.s i do not want to get rid of them just output them and redirect them in another file.
There must be a way to do it without using sed or awk isn it?
Thnx -
if i do in this way $1>>$2 the line of text would go at the end of the file and not on the top of the file.
how about f i use -ed- editor?Leave a comment:
-
Shell script programming
Can anybody give me an hint on how to answer this questions?
"For the following and any subsequent exercises you ARE NOT permitted to use either SED or AWK".
Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.
Write a script that takes two arguments. The first being a line of text, the second being your newly created...
No activity results to display
Show More
Leave a comment: