10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have a data file 'File2' consisting of 105670 lines. I want to copy and paste 17928 lines from 'File1' to 'File2' but I want to place it in between lines 21 and 17950 of 'File2'. How do I do it in awk?
For example-
File A has 5 lines
X
Y
1 2 3
4 5 6
7 8 9
and File B has
A
b... (1 Reply)
Discussion started by: ananyob
1 Replies
2. Shell Programming and Scripting
Hi
I have a data file 'File2' consisting of 105670 lines. I want to copy and paste 17928 lines from 'File1' to 'File2' but I want to place it in between lines 21 and 17950 of 'File2'. How do I do it in awk?
For example-
File A has 5 lines
X
Y
1 2 3
4 5 6
7 8 9
and File B has
A
b... (1 Reply)
Discussion started by: ananyob
1 Replies
3. Shell Programming and Scripting
Hi,
Below is my issue which I desperately need and I want a shell script which can do this job.
1. There are 10 log files in a particular location.
2. open each log file. Goto to the end of the file. From the end go up to find a particular text. From this particular text till the end of... (3 Replies)
Discussion started by: kashriram
3 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I want to write a script that takes a file and a string as params and adds the string to the middle line of the file. Also, I want to output the results back to the original file passed without using temp files.
I am very much new to UNIX so this is all a little like black magic to me at... (15 Replies)
Discussion started by: Chiefos
15 Replies
5. UNIX for Dummies Questions & Answers
Hey guys, how do we take a line of text as an argument from a user and then insert it in the middle of a file irrespective of the number of lines in the file. I am trying to do this without SED or AWK. Inserting it in the beginning and at the end is easy, but i am trying to accomplish inserting... (6 Replies)
Discussion started by: kartikkumar84@g
6 Replies
6. Shell Programming and Scripting
Can anyone help me pls? I want to add a text into the middle of file.
I've writtenthe following script
text to add="$1"
file="$2"
lines=$(wc -l $2)
half_lines=$(expr $lines / 2)
head -$half_lines $2 > temp
echo "text to add" >> temp
((half_lines=$half_lines + 1))
tail -$half_lines $2... (6 Replies)
Discussion started by: relle
6 Replies
7. Shell Programming and Scripting
I have a file in which I clean out a bunch of nonsense text as well as path information.
What I end up with is something like the following:
johnson.........................................................933
Where the periods represent the whitespace
The file comes out originally with... (2 Replies)
Discussion started by: roninuta
2 Replies
8. Shell Programming and Scripting
i 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.
... (6 Replies)
Discussion started by: ciroredz
6 Replies
9. Shell Programming and Scripting
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 file. The script should take the first argument and insert it into the very top (the... (3 Replies)
Discussion started by: ali hussain
3 Replies
10. Shell Programming and Scripting
hi,
i have a file
file1 file2
----------- -----------------
aa bbb ccc 111 1111 1111
ddd eee fff 222 3333 4444
ggg hhh... (5 Replies)
Discussion started by: go4desperado
5 Replies