Order text by delimiters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Order text by delimiters
# 8  
Old 11-03-2009
With awk is this possible?
I mean...something like this:

When find 'interface' put all lines with de 'interface word in the field $1, and
if find 'description' put all lines in the field $2, and if find 'ip' put all lines in the field $3.

Thanks for tour answers!! Smilie
# 9  
Old 11-03-2009
Something like this?

Code:
awk '/interface/{s=$0} /description/{s=s FS $0} /ip/{print s FS $0} ' file

# 10  
Old 11-03-2009
Quote:
Originally Posted by Franklin52
Something like this?

Code:
awk '/interface/{s=$0} /description/{s=s FS $0} /ip/{print s FS $0} ' file

thanks, is what I need....but how write de output in a file?

the command awk .......> file_output did not work.
# 11  
Old 11-03-2009
That's exact the same question you've asked above. Please read some books/tutorials regarding shell scripting.

Here you can find the answer to your question:

All about redirection

Regards
# 12  
Old 11-03-2009
Quote:
Originally Posted by Franklin52
That's exact the same question you've asked above. Please read some books/tutorials regarding shell scripting.

Here you can find the answer to your question:

All about redirection

Regards
Ok Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

find & Replace text using two non-unique delimiters.

I can find and replace text when the delimiters are unique. What I cannot do is replace text using two NON-unique delimiters: Ex., "This html code <text blah >contains <garbage blah blah >. All tags must go,<text > but some must be replaced with <garbage blah blah > without erasing other... (5 Replies)
Discussion started by: bedtime
5 Replies

2. Shell Programming and Scripting

How to put delimiters in text files after fix characters?

Hi , i have a text file in which i want to put delimiters after certain characters ( fix),. like put a delimiter (any like ,) after 1-3 character than 4 than 5 than 6-17 ..... files looks like this (original)... (8 Replies)
Discussion started by: anamdev
8 Replies

3. UNIX for Dummies Questions & Answers

Text order

Hello unix.com I have a large text file in this format: merali guzman 34 vernon st 304 hartford CT Connecticut 6106 012-233-232 Working 13/14 100$ Morgan Dvorak 5670 Echo Road Excelsior MN Minnesota 5331 000-000-123 Sleeping 15/17 220$ How can... (1 Reply)
Discussion started by: galford
1 Replies

4. Shell Programming and Scripting

Print text between delimiters IF it contains a certain term...

So I'm racking my brain on appropriate ways to solve a problem that once fixed, will solve every problem in my life. Its very easy (for you guys and gals) I'm sure, but I can't seem to wrap my mind around the right approach. I really want to use bash to do this, but I can't grasp how I'm going to... (14 Replies)
Discussion started by: eh3civic
14 Replies

5. Shell Programming and Scripting

Fetch the rows with match string on a fixed lenth text file - NO delimiters

Hi I am trying to fetch the rows with match string "0000001234" Input file looks like below: 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1... (6 Replies)
Discussion started by: nareshk
6 Replies

6. AIX

Print text between two delimiters

Hi, Can somebody help me with the below situation, Input File, ======== 2007_08_07_IA-0100-014_(MONTHLY).PDF 2007_08_07_IA-0100-031_(QUARTERLY)(RERUN).PDF 2008-02-28_KR-1022-003_(MONTH)(RERUN)(REC1).CSV Required output, ============ MONTHLY QUARTERLY MONTH ... (15 Replies)
Discussion started by: sravicha
15 Replies

7. Programming

c program to extract text between two delimiters from some text file

needa c program to extract text between two delimiters from some text file. and then storing them in to diffrent variables ? text file like 0: abc.txt ========= aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass... (7 Replies)
Discussion started by: kukretiabhi13
7 Replies

8. Shell Programming and Scripting

Ascending order within text

I appreciate all the help that I've already received but am running into one problem. I can find how to add something before a file with ascending numbers but not like this. I basically have a file that looks like this: 100 101 102 103 104 I need to add the following before each line with... (5 Replies)
Discussion started by: kerpm
5 Replies

9. UNIX for Advanced & Expert Users

extract text b/w two delimiters

I have an input file which looks like " @$SCRIPT/atp_asrmt_adj.sql $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1005w.pls $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1006w.pls start $SCRIPT/cim1020d.sql;^M spool $DATA/cim1021m.sql @$DATA/cim1021m.sql ! rm $DATA/cim1021m.sql spool $DATA/cim1021m.sql... (6 Replies)
Discussion started by: dowsed4u8
6 Replies

10. Shell Programming and Scripting

Order text display not correct.

My shell script below for import data to Oracle it run okay. but the text display not correct follow order command executed. =========================Shell Script code================= #!/bin/sh #directory = ${1-'pwd'} #run import data with SQLLoader runSQLLoader() { ... (2 Replies)
Discussion started by: raccsdl
2 Replies
Login or Register to Ask a Question