Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extracting lines and saving - awk Post 302229892 by madhaviece on Thursday 28th of August 2008 06:32:47 AM
Old 08-28-2008
Extracting lines and saving - awk

Hi All,

I am trying to extract lines bsed on pattern matching../mp straight-flow/
Extracted output should be saved in meta_string , but the code is not working in that manner,saving repeated lines. can anyone please suggest where am i going wrong.


/mp straight-flow/ {
start=index($0,"straight-flow");
if ($2=="straight-flow") meta_string=(meta_string "\n" substr($0,start));
print(meta_string);

mp straight-flow Transformation_records_to_fit_COBOL_Requirement.Generate_DAG_Counts.Flow_24 Transformation_records_to_fit_CO
BOL_Requirement.Generate_DAG_Counts.Repl_Produce_3_flows.out Transformation_records_to_fit_COBOL_Requirement.Generate_DAG_Cou
nts.Rlup_Count_DAG_Occurence.in -metadata metadata4
mp straight-flow Transformation_records_to_fit_COBOL_Requirement.Generate_DAG_Counts.Flow_25 Transformation_records_to_fit_CO
BOL_Requirement.Generate_DAG_Counts.Repl_Produce_3_flows.out Transformation_records_to_fit_COBOL_Requirement.Generate_DAG_Cou
nts.Jn_Add_DAG_Count_to_Incoming_Records.in.in0 -metadata metadata4 -buffer
mp straight-flow Transformation_records_to_fit_COBOL_Requirement.Generate_DAG_Counts.Flow_23 Transformation_records_to_fit_CO
BOL_Requirement.Generate_DAG_Counts.Rlup_Count_DAG_Occurence.out Transformation_records_to_fit_COBOL_Requirement.Generate_DAG
_Counts.Jn_Add_DAG_Count_to_Incoming_Records.in.in1 -metadata metadata5 -buffer


Regards,
Madhavi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk : extracting unique lines based on columns

Hi, snp.txt CHR_A SNP_A BP_A_st BP_A_End CHR_B BP_B SNP_B R2 p-SNP_A p-SNP_B 5 rs1988728 74904317 74904318 5 74960646 rs1427924 0.377333 0.000740085 0.013930081 5 ... (12 Replies)
Discussion started by: genehunter
12 Replies

2. Shell Programming and Scripting

Extracting lines by using awk

Hello, I have a file including some lines as follows person (1): a d t person (2): f h j person (3): z x v . . . (8 Replies)
Discussion started by: rpf
8 Replies

3. Shell Programming and Scripting

Saving ranges using awk

Hi All, Is there a way to save a range in variable for later printing? for example write somthing like this: awk ' /pattern1/,/pattern2/{f=range} /pattern3/{print f} ' I don't know excatly what "range" could be but is there a way to do this? (8 Replies)
Discussion started by: ghoda2_10
8 Replies

4. Shell Programming and Scripting

Saving an AWK match

Is it possible to save the result of an AWK match to use later in a BASH script. Thanks, Jordon (4 Replies)
Discussion started by: jhirshon
4 Replies

5. Shell Programming and Scripting

AWK- extracting values from columns, saving them and gettins statistics

Hello, I am obviously quite new to unix and awk. I need to parse certain columns of a file (delimited by spaces), and somehow save the value of this column somewhere, together with the value of the column just after it (by pairs; so something like ). I'm then supposed to count the times that... (9 Replies)
Discussion started by: acsg
9 Replies

6. Shell Programming and Scripting

AWK script - extracting min and max values from selected lines

Hi guys! I'm new to scripting and I need to write a script in awk. Here is example of file on which I'm working ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00 ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00 ATOM 4690 CD ... (18 Replies)
Discussion started by: grincz
18 Replies

7. UNIX for Dummies Questions & Answers

Help with deleting lines and saving them

I have a directory question where I ask the user which entry he wants to delete... echo "Which entry?" read entry sed '/^'$entry'/d' file This code does in fact delete that particular entry... HOWEVER, when I go to inquire about that same entry, it still populates like it was never... (4 Replies)
Discussion started by: itech4814
4 Replies

8. Shell Programming and Scripting

exit after extracting range if lines - awk

Hello, I was wondering how is it possible if I use this command: awk 'NR >= 998 && NR <= 1000' file.txtTo exit after parsing the 1000th line ( last line targeted) ??? I observed that when executing this command for a large file, if the range of lines is at the beginning of the file it is... (2 Replies)
Discussion started by: black_fender
2 Replies

9. Shell Programming and Scripting

Extracting lines from a file with sed and awk

My source file is structured with two words on each line word1 word2 word1 word2 I am using sed and awk to grab groups of specific lines line=`awk 'NR>=4 && NR<=7' file1`; echo $line line=` sed -n '1,5'p file1`; echo $line The resulting output is word1 word2 word1 word2 word1... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

10. UNIX for Beginners Questions & Answers

Saving first n lines of history

Say you want to clear your .bash_history except for the first 25 lines. Try: sed -i -e 26,500d .bash_historyI have a some frequently-used routines parked in the first few lines, and they kept getting overwritten by more recent commands. (2 Replies)
Discussion started by: Xubuntu56
2 Replies
AuWriteElement(3)					     Library Functions Manual						 AuWriteElement(3)

Name
       AuWriteElement - write data to an ImportClient element in a flow

Synopsis
       #include <audio/audiolib.h>

       void AuWriteElement(server, flow, element, num_bytes, data, end_of_data, status)
	   AuServer *server;
	   AuFlowID flow;
	   int element;
	   AuUint32 num_bytes;
	   AuPointer data;
	   AuBool end_of_data;
	   AuStatus *status; /* RETURN */

Arguments
       server	 Specifies the connection to the audio server.

       flow	 Specifies the ID of the flow.

       element	 Specifies the index of the ImportClient element to write the data to.

       num_bytes Specifies the number of bytes of audio data to write.

       data	 Specifies the buffer to get the audio data from.

       end_of_data
		 Specifies if this is the last write for this import.

       status	 If non-NULL, flush the output buffer and return the status from the server.

Description
       AuWriteElement transfers audio data from the client application to the server, writing num_bytes from data to the ImportClient specified by
       element in the audio flow flow.	If end_of_data is AuTrue, the ImportClient's eof flag will be set when the write is completed.

Note
       If the flow is "trivial" (consisting only of an ImportClient and an ExportBucket), the num_samples fields in the ImportClient  and  Export-
       Bucket are ignored and a write past the end of the bucket will result in an AuBadLength error.

Errors
       AuBadFlow, AuBadElement, AuBadValue, AuBadLength.

See Also
       AuReadElement.

       audiolib - Network Audio System C Language Interface

audiolib - write to element					       1.9.3							 AuWriteElement(3)
All times are GMT -4. The time now is 01:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy