Sponsored Content
Top Forums Shell Programming and Scripting ksh sed - Extract specific lines with mulitple occurance of interesting lines Post 302889982 by Chubler_XL on Monday 24th of February 2014 03:57:47 PM
Old 02-24-2014
How about this:

Code:
awk '
/^primary$/ {ARMED=1}
ARMED==1 && /^\*/ {SLOT=$2}
$1="Slot" && $2==SLOT{ARMED=2}
/^Touch:/ && ARMED==2{print "Slot " SLOT;print; SLOT=ARMED=0}' infile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract specific lines from file

hi, how would i extract a range of lines in a file by using the line number? ex: file contains: 1 title 2 i want 3 this part 4 to be taken out 5 from this file 6 and sent to 7 another file 8 not needed 9 end of file In this case, i want to copy line number 2 to 7 on a new... (2 Replies)
Discussion started by: apalex
2 Replies

2. UNIX for Dummies Questions & Answers

Extract specific lines for graphing

Hello, I have a very large text file with about 2 million lines. Each of the lines starts like.. SNP_12345678 A 1212, 121, 343, ... SNP_12345678 B 4567, 567, 454, ... and so on. I want to extract specific SNPs and plot them by GNUplot or excel. The file is too large to be opened by text... (1 Reply)
Discussion started by: genehunter
1 Replies

3. Shell Programming and Scripting

extract the lines between specific line number from a text file

Hi I want to extract certain text between two line numbers like 23234234324 and 54446655567567 How do I do this with a simple sed or awk command? Thank you. ---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ---------- found it: sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies

4. Shell Programming and Scripting

Extract lines of text based on a specific keyword

I regularly extract lines of text from files based on the presence of a particular keyword; I place the extracted lines into another text file. This takes about 2 hours to complete using the "sort" command then Kate's find & highlight facility. I've been reading the forum & googling and can find... (4 Replies)
Discussion started by: DionDeVille
4 Replies

5. UNIX for Dummies Questions & Answers

unix: extract a specific list of lines from a file

I would like to extract specific lines from a file and output them into another file. Each line in the file has a unique ID, and I have a specific list of IDs (that are not consecutive) that I wish to extract. for example: 1 aaaaaa bbbcb cccccc 2 aaaaaa bbbbb cccccd 3 aaaaaa bbbab... (6 Replies)
Discussion started by: mert2481
6 Replies

6. Shell Programming and Scripting

Extract specific lines from a file

Hi, I have a file which contains DDL statements- CREATE TABLE, CREATE INDEX, ALTER TABLE etc. I have to only pick CREATE TABLE statements from the file- Source : ---------------------------------------------- --DDL for table abc -------------------------------------------- CREATE TABLE... (4 Replies)
Discussion started by: newb
4 Replies

7. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

8. UNIX for Dummies Questions & Answers

Extract lines with specific words with addition 2 lines before and after

Dear all, Greetings. I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed. For example, the input file is: 1 ak1 abc1.0 1 ak2 abc1.0 1 ak3 abc1.0 1 ak4 abc1.0 1 ak5 abc1.1 1 ak6 abc1.1 1 ak7... (7 Replies)
Discussion started by: Amanda Low
7 Replies

9. Shell Programming and Scripting

Extract lines with unique value using a specific column

Hi there, I need a help with extracting data from tab delimited file which look like this #CHROM POS ID REF ALT Human Cow Dog Mouse Lizard chr2 3033 . G C 0/0 0/0 0/0 1/1 0/0 chr3 35040 . G T 0/0 0/0 ./. 1/1 0/1 chr4 60584 . T G 1/1 1/1 0/1 1/1 0/0 chr10 7147815 . G A 0/0 1/1 0/0 0/0... (9 Replies)
Discussion started by: houkto
9 Replies

10. Shell Programming and Scripting

Extract specific lines based on another file

I have a folder containing text files. I need to extract specific lines from the files of this folder based on another file input.txt. How can I do this with awk/sed? file1 ARG 81.9 8 81.9 0 LEU 27.1 9 27.1 0 PHE .0 10 .0 0 ASP 59.8 11 59.8 0 ASN 27.6 12 27.6 0 ALA .0 13 .0 0... (5 Replies)
Discussion started by: alanmathew84
5 Replies
rancid_intro(1) 					      General Commands Manual						   rancid_intro(1)

NAME
rancid_intro - introduction to the Really Awesome New Cisco confIg Differ INTRODUCTION
rancid is really more than just a Cisco configuration differ. It handles several different device's configurations; currently including Alteon, Arista, Bay Networks (Nortel), Cisco, Extreme, F5 BigIP, Force10, Fortinet, Foundry, HP Procurve switches, Hitachi, Juniper Routers and edge (ERX) routers, Lucent TNT, MRTd daemon, Netscalar load balancers, Netscreen firewalls, Procket, Redback, SMC switches, Zebra routing software, and the ADC-Kentrox EZ-T3 mux. rancid uses an expect script to login to each of a list of devices and run a set of commands for that device-type and collects the output. The output is run through some filtering to summarize, reformat, and/or snip unwanted or security related data such as chassis temperature and easily reverse-able passwords. Named after the device's name in the group's configuration file (router.db), the resulting files are saved in the directory <group>/configs. Except for the data filtered from the configuration file for security reasons, such as reversable passwords, these files are suitable for loading directly to restore a lost configuration. See rancid.conf(5) for more information on <group>s. After filtering, a uni-diff (see diff(1)) of the result is produced for each of the devices in a group against that of the previous run of rancid and is e-mailed to that group's mail list, "rancid-<group>". This e-mail will also include any differences of the device list in the group's configuration file, router.db. Lastly, all the updated files are checked into the revision control system (CVS or Subversion). Additional utilities, including a looking glass, come with rancid. See rancid's share directory ( share/rancid). EXAMPLE E-MAIL Below is a sample of a uni-diff produced from the group "shrubbery" for the device named dfw.shrubbery.net, which happens to be a Cisco GSR. From: rancid To: rancid-shrubbery@shrubbery.net Subject: shrubbery router config diffs Precedence: bulk Index: configs/dfw.shrubbery.net =================================================================== retrieving revision 1.144 diff -u -4 -r1.144 dfw.shrubbery.net @@ -57,14 +57,8 @@ !Slot 2/MBUS: hvers 1.1 !Slot 2/MBUS: software 01.36 (RAM) (ROM version is 01.33) !Slot 2/MBUS: 128 Mbytes DRAM, 16384 Kbytes SDRAM ! - !Slot 6: 1 Port Gigabit Ethernet - !Slot 6/PCA: part 73-3302-03 rev C0 ver 3, serial CAB031216OL - !Slot 6/PCA: hvers 1.1 - !Slot 6/MBUS: part 73-2146-07 rev B0 dev 0, serial CAB031112SB - !Slot 6/MBUS: hvers 1.2 - !Slot 6/MBUS: software 01.36 (RAM) (ROM version is 01.33) !Slot 7: Route Processor !Slot 7/PCA: part 73-2170-03 rev B0 ver 3, serial CAB024901SI !Slot 7/PCA: hvers 1.4 !Slot 7/MBUS: part 73-2146-06 rev A0 dev 0, serial CAB02060044 In this example, we see that a Gigabit Ethernet linecard was removed from slot 6. However, since this data is collected from "show" commands on the router, it could just as easily be that the card crashed so the RP can not communicate with it to collect information. GETTING STARTED
Installation instructions are included in the distribution's top-level directory in the README file (which will be installed in share/rancid). Once the installation is complete, start by reading the man pages listed below or follow the basic instructions included in the README file. See http://www.shrubbery.net/rancid for information on new versions, mail lists, etc. ADDING NEW GROUPS
Follow this procedure for adding new groups: o Update the LIST_OF_GROUPS variable in etc/rancid.conf (see rancid.conf(5)). o Run rancid-cvs(1). o Update the system's mail aliases file /etc/aliases (see rancid.conf(5)). SEE ALSO
clogin(1), cloginrc(5), control_rancid(1), lg_intro(1), rancid(1), rancid-run(1), rancid.conf(5), router.db(5) 14 july 2009 rancid_intro(1)
All times are GMT -4. The time now is 08:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy