Sponsored Content
Top Forums Shell Programming and Scripting Extract lines from file using keywords using script Post 302770052 by surender reddy on Thursday 14th of February 2013 10:05:11 AM
Old 02-14-2013
Hi ,
code is working fine but i need ip or host name in output file .now iam not able to difffernaite which output is belongs to which router.

HTML Code:
/usr/xpg4/bin/awk '/^[a-zA-Z]/{if(/^Card Status/||/^Max Circuits/||/^Num Circuits \(TOTAL\)/) f=1; else f=0;}f==1{print}' n1
output

HTML Code:
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,   3: 32768,   4: 32768,   5:     0,  
               6:     0,   7:     0,   8:     0,   9: 16384,  10:     0,  
              11:     0,  12:     0,  13:     0,  14:  4096,  

Num Circuits (TOTAL):
               1:     4,   2:  8959,   3: 10591,   4:     4,   5:     4,  
               6:     0,   7:     1,   8:     0,   9:    12,  10:     0,  
              11:     0,  12:     0,  13:     0,  14:     1,  

Card Status :  1:1,  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:0, 

Max Circuits:  1: 32768,   2: 32768,   3: 32768,   4: 32768,   5:     0,  
               6:     0,   7:     0,   8:     0,   9: 16384,  10:     0,  
              11:     0,  12:     0,  13:     0,  14:     0,  

Num Circuits (TOTAL):
               1:  4916,   2: 10976,   3:  9385,   4:     7,   5:     0,  
               6:     0,   7:     1,   8:     0,   9:    14,  10:     0,  
              11:     0,  12:     0,  13:     0,  14:     0,  

Card Status :  1:0,  2:1,  3:1,  4:0,  5:1,  6:1,  7:0, 
               8:0,  9:1, 10:0, 11:0, 12:0, 13:0, 14:0, 

Max Circuits:  1:     0,   2: 32768,   3: 32768,   4:     0,   5: 32768,  
               6: 32768,   7:     0,   8:     0,   9: 16384,  10:     0,  
              11:     0,  12:     0,  13:     0,  14:     0,  

Num Circuits (TOTAL):
               1:     0,   2: 18651,   3:  6325,   4:     0,   5:     4,  
               6:     1,   7:     1,   8:     0,   9:    13,  10:     0,  
              11:     0,  12:     0,  13:     0,  14:     0,  
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture lines based on keywords

Hello everyone, I am trying to write a script that will capture few lines from a text file based on 2 keywords in the first line and 1 keyword in the last one. It could also be based on the first line only + the folllowing 3 lines. Could some one help or give directions. Thanks. (4 Replies)
Discussion started by: nimo
4 Replies

2. Shell Programming and Scripting

Script that extract some lines from a file lookin into another

I want a ksh script that parse two files (text files, actually my original files are .xls) - input data: - one file file1 containig lines separated by spaces (or other delimiter) - 2nd one file2 contain only one numerical value in a line (for simplicity but it might of the same form as the 1st)... (7 Replies)
Discussion started by: heartwork
7 Replies

3. Shell Programming and Scripting

Sorting lines based on keywords for MySQL script

the thing which i require is very very complex.. i tried hard to find the solution but couldnt.. the thing i need to achieve is say i have a file cat delta.sql CREATE VIEW Austin Etc etc . . . CREATE VIEW Barabara AS SELECT blah blah blah FROM Austin z, Cluster s, Instance i WHERE... (4 Replies)
Discussion started by: vivek d r
4 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. 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

6. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

7. Shell Programming and Scripting

Script needed to extract few lines from file

Hello, I need a utility script or command that will extract the following lines from a file based on a 'word' contain in a line. For example my file contains lot of lines. So if i pass 1800182 to the script/command it should return everything between 1st RequestNetRates tag before it and 1st... (4 Replies)
Discussion started by: jakSun8
4 Replies

8. Shell Programming and Scripting

Extract word between two KEYWORDS

Hi I want to extract all the words between two keywords HELLO & BYE. eg: Input 1_HELLO_HOW_ARE_YOU_BYE_TEST 1_HELLO_WHERE_ARE_BYE_TEST 1_HELLO_HOW_BYE_TEST Output Required: HOW_ARE_YOU WHERE_ARE HOW (7 Replies)
Discussion started by: dashing201
7 Replies

9. Shell Programming and Scripting

Display lines between keywords inclusive

Hi, I have a file that contains a lot of lines that are repetitive. I am interested in grepping the following section which is repetitive. ::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::: <Address> <Street>xxxy</Street> ... (3 Replies)
Discussion started by: jakSun8
3 Replies

10. UNIX for Dummies Questions & Answers

Copy Lines between Keywords & paste them to another file

hi, I have Multiple files with the following data : File1 100414 DR1 END XXXXX Test1 Test2 Test3 Test4 Test5 Test6 END 100514 DR2 END XXXXX Test7 Test8 Test9 Test10 Test11 Test12 END 100614 DR3 (5 Replies)
Discussion started by: newageBATMAN
5 Replies
mlib_SignalQuant_S16S_F32S(3MLIB)			    mediaLib Library Functions				 mlib_SignalQuant_S16S_F32S(3MLIB)

NAME
mlib_SignalQuant_S16S_F32S - float to 16-bit quantization SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_SignalQuant_S16S_F32S(mlib_s16 *dst, const mlib_f32 *src, const mlib_f32 *thresh, mlib_s32 n); DESCRIPTION
The mlib_SignalQuant_S16S_F32S() function quantizes a signal array by using the following equation: X = x(n) n = 0, 1, ... Z = z(n) n = 0, 1, ... = -32768 for x(n) < t(-32768) = k for t(k) <= x(n) < t(k+1) = +32767 for x(n) >= t(+32767) PARAMETERS
The function takes the following arguments: dst Output signal array in two-channel interleaved stereo format. src Input signal array in two-channel interleaved stereo format. thresh Array of 65536 thresholds. n Number of samples in the input signal array. RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 2 Mar 2007 mlib_SignalQuant_S16S_F32S(3MLIB)
All times are GMT -4. The time now is 07:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy