Copy Lines between Keywords & paste them to another file
hi,
I have Multiple files with the following data :
File1
Required Output:
1. Search for the Date(Lets Say: 100614) and copy the line
2. append at the end of every line after the immediate XXXXX till "END" is encountered along with the file name
3. Same will be done for all files in the folder & the Output will be in another file in the same Folder
Output
here data from Other files in the same Folder will also reflect
Plz suggest some scripts or Logics to implement the same ...
Last edited by Scrutinizer; 04-03-2014 at 08:19 AM..
Reason: code tags
Sorry for delayed reply, but your one liner worked like a Charm. Output is just the way I wanted.
But for every file data is appearing 5 times & 1st data is correct, but the remaining 4 times are Wrong. i.e. Suppose I ran the above line,
Test10 Test13 Test20 100614 DR3 FILE1
Test20 Test14 Test21 100614 DR3 FILE1
Test30 Test15 Test22 100614 DR3 FILE1
Test40 Test16 Test23 100614 DR3 FILE1
Test50 Test17 Test24 100614 DR3 FILE1
in the above example, 1st Paragraph data is Ok, but 2nd paragraph data is from a different date but comes with 100614 stamp
and Same thing happening for all remaining files.
Hope I 'm able to explain the issue ...
---------- Post updated at 12:15 AM ---------- Previous update was at 12:14 AM ----------
Quote:
Originally Posted by SriniShoo
If the file structure is same, below will work
Dear.. not able to test the code till now, will test & reply by tomorrow...
---------- Post updated at 09:18 AM ---------- Previous update was at 12:15 AM ----------
Quote:
Originally Posted by SriniShoo
If the file structure is same, below will work
Hi Srini...
When I run the code, there is no Op.. this is the exact code I executed in Cygwin terminal ...
awk '$1 ~ pat {for(i = 4; i < NF; i++) {printf "%s %s %s\n", $i, $1, FILENAME}}' FS='\n' RS= pat='140320' *.* > Output.log
Try the below
And, if the filenames are FILE1, FILE2, ..., you cannon use "*.*" in the command for files...Confirm your files have extension if you are using the "*.*" in place of file name
Hi I have a text file with lines beginning with 71303, 71403, 71602,
I need to copy the 10 digit text at position 30 on lines beginning with 71303 (5500011446) to position 99 on every line beginning with 71602 (see example below),
There may be many 71303 lines but I need the text copying to... (2 Replies)
I have a really big XML file. I need copy the value of one tag inside another one tag. I try to publish one example.
<channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1">Rai 1</channel>
<channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1 +2HD">Rai 1... (6 Replies)
Hi
I need some lines of text from input file using keywords.
Inputfile
IP IS 10.238.52.65
pun-ras-bng-mhs-01#context bsnl.in
Card Status : 1:0, 2:1, 3:1, 4:1, 5:0, 6:0, 7:0,
8:0, 9:1, 10:0, 11:0, 12:0, 13:0, 14:1,
Max Circuits: 1: 0, 2: 32768, ... (5 Replies)
Hello
I want to read from a file which contains email addresses.
The file format is like this.
from@mail.com
to1@mail.com
to2@mail.com
cc@mail.com
bcc@mail.com
I'll have to read from such file and assign the email addresses to respective variables.
frommail =... (11 Replies)
Please help me. This is simple, but urgent problem for me. :(
I have a two files
file1
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
.....
file2
11 12 13 14 15
11 12 13 14 15
11 12 13 14 15
.....
1) I hope to make a new file, file 3, that consists of 2nd... (2 Replies)
Hi Guys,
I have the following problem. I have original file (org.txt) that looks like this
module v_1(.....)
//arbitrary number of text lines
endmodule
module v_2(....)
//arbitrary number of text lines
endmodule
module v_3(...)
//arbitrary number of text lines
endmodule
module... (6 Replies)
Hi All,
I want to edit my gate level netlists by searching for the content between two patterns
eg:
ff1 \test/a0 ( .CLK(\test/ClkInt0_acb_00x1 ),.D(\test/Rakicc ), .QB(\test/X ), .VDD(1'b1), .VSS(1'b0));
ff1 \test/a1 ( .CLK(\test/medis0_acb_00x1 ),.D(\test/hedwc ), .QB(\test/X ),... (6 Replies)
Dear All,
I am working with windoes OS but remote a linux machine. I wonder the way to copy an paste some part of a huge file in linux machine.
the contain of file like as follow:
...
dump annealling all custom 10 anneal_*.dat id type x y z q
timestep 0.02
run 200000
Memory... (2 Replies)
Hi all,
I'm a unix newb andI'm trying to write a script that can copy some text paste it in a certian place and then add a number. It's not really clear but I'll show an example.
what the file looks like right now:
Linux 2.6.24-24-generic (abc) 07/15/09
23:25:01 CPU ... (6 Replies)