Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Copy Lines between Keywords & paste them to another file Post 302897243 by newageBATMAN on Saturday 12th of April 2014 07:25:16 AM
Old 04-12-2014
Hi Panyam ....

with slight modification of Logic the multi printing issue resolved. final lines looks like following:

Code:
awk '/100614/ {a=$0;c=1;b=0;next} /xxxxxxxxx/&&c==2 {b=1;next}  /END/ {c=c+1;b=0;next} b&&c&&NF>=6 { printf "%s %s %s  \n",$0,a,FILENAME  } ' file*

Thanks for the Support ...

---------- Post updated at 04:55 PM ---------- Previous update was at 04:52 PM ----------

@Srini

still not getting any output for your line, mmm

$i in the for loop will print fields or lines !!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/grep copy and paste and insert in between lines.

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)
Discussion started by: the1hand3r
6 Replies

2. UNIX for Dummies Questions & Answers

copy and paste certain many lines of huge file in linux

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)
Discussion started by: ariesto
2 Replies

3. Shell Programming and Scripting

copy the contents between two keywords to a new file.

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)
Discussion started by: naveen@
6 Replies

4. Shell Programming and Scripting

copy range of lines in a file based on keywords from another file

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)
Discussion started by: kaaliakahn
6 Replies

5. Shell Programming and Scripting

Copy a column and paste to other file question

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)
Discussion started by: exsonic
2 Replies

6. UNIX for Dummies Questions & Answers

Reading specific lines from a file using index or keywords

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)
Discussion started by: Kyaw Lwin Phyo
11 Replies

7. Shell Programming and Scripting

Extract lines from file using keywords using script

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)
Discussion started by: surender reddy
5 Replies

8. Shell Programming and Scripting

Copy and paste text inside a xml file

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)
Discussion started by: Tapiocapioca
6 Replies

9. Shell Programming and Scripting

Bash copy and paste text in file from one position to another

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)
Discussion started by: firefox2k2
2 Replies
ROOTTAIL(1)						      General Commands Manual						       ROOTTAIL(1)

NAME
root-tail - print text directly to X11 root window SYNOPSIS
root-tail [-g|--geometry GEOMETRY] [-fn|--font FONTSPEC] [--color color] [--reload SEC COMMAND] [--shade] [--outline] [--minspace] [--noflicker] [-f|--fork] [--reverse] [--whole] [--partial] [--update] [--cont STRING] [--wordwrap] [--justify] [--noinitial] [--frame] [-id ID] [-i|--interval SECONDS] [-V] file1[,color[,desc]] [file2[,color[,desc]]] DESCRIPTION
Displays a given file anywhere on your X11 root window, i.e. it is kind of tail -f for multiple files using your desktop background as out- put window. All non-option arguments on the command line are files to be logged. A null desc (example: "/var/log/messages,red,") will prevent the printing of a description and the []'s. General Options --color COLOR Use COLOR as default. --font | -fn FONTSPEC Use font FONTSPEC. This can be either a fixed width font like -fn fixed or any font using -fn '-*-*-*-*-*-*-*-*-*-*-*-*-*-*' with the appropriate fields filled out (see xfontsel). Specifying a different FONTSPEC before each filename will cause each file to be displayed in a different font. -f | --fork Forks to the background. --reverse Display the files in reverse order, with the newest lines at the top. --whole Only display whole lines. If the last line of a file doesn't yet end with a newline character then wait until it does before dis- playing it. This is the default if more than one file is being displayed. --partial This is the opposite of the --whole option (see above). It displays lines even if they don't yet have a newline at the end. This is the default if only one file is being displayed. --update Update partial lines 'in place' if they are still on the screen when they are updated in their files. Using --update automatically turns on --partial. --cont STRING When partial lines are broken into two lines in the display, prefix the 2nd line with STRING. Defaults to "|| ". Specify the "--whole" argument to ensure partial lines are never displayed, or specify "--update" to attempt to "repair" broken lines in-place. --cont-color COLOR Use COLOR when displaying the continuation string (as optionally specified with the --cont option above). --wordwrap The default behaviour is to fit as much as possible onto each line of output, even if this means splitting a word between one line and the next. The --wordwrap argument splits lines at spaces if possible. --justify After wrapping long lines, attempt to justify the text to produce a smooth right-hand margin. Implies --wordwrap. --reload SEC COMMAND Re-display the file(s) and run COMMAND every SEC seconds. The default is to never re-display the file(s). --shade Add black shading to the font. --outline Add a black outline to the font (making redraws quite a bit slower). --minspace Use minimum linespace even when using shading or outlining. This might result in leftover pixels (dependign on font and logfile con- tent). --noflicker Use slower but flicker-free update. --noinitial Don't display the end of the file(s) initially. -id ID Use the given window ID for output instead of the root window. -i | --interval SECONDS Use the specified sleeping interval between checks instead of the default 2.4 seconds. Fractional values are OK. -V Print version information. --frame Draw a frame around the selected area. This is useful when trying to find the perfect geometry. EXAMPLE
root-tail -g 800x250+100+50 -font 10x20 /var/log/messages,green -font 12x24 /var/log/secure,red,'ALERT' BUGS
Some desktop environments open a virtual root window and make it difficult to share it. If you cannot see anything after starting root- tail, try to find a setting "allow programs on desktop" or similar, or manually specify a window id. Should you happen to find any bugs please fix them and send me a diff. NOTE: This program was modified by Marc Lehmann <pcg@goof.com>, who couldn't reach the original author. Please direct bug-reports etc. to pcg@goof.com. http://root-tail.plan9.de/ 4.2 Berkeley Distribution 2004-03-27 ROOTTAIL(1)
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy