awk -- sort out the out put file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk -- sort out the out put file
# 1  
Old 06-02-2009
awk -- sort out the out put file

Hi,

using awk /sed, I need to sort out the input file.

here is the example
input file===

Name= shashi | country= india | region = asia | dept= ww
Name= jon | region = asia | dept= xx
Name=sam | dept= ww
Name= anthony | country=england | dept= xx
Name= sumo | country= china

output should be=====>


Name= shashi | country= india | region = asia | dept= ww
Name= jon | country= 0 | region = asia | dept= xx
Name=sam | country= 0 | region = 0 |dept= ww
Name= anthony | country=england |region = 0| dept= xx
Name= sumo | country= china |region = 0| dept= 0

thaqnks in advance..
# 2  
Old 06-02-2009
sort out?? on what condition??
# 3  
Old 06-02-2009
as per my requirment , is it possible to do using awk/sed ?
or any other solution ?
# 4  
Old 06-02-2009
what have you tried? you have already know about awk and shell scripting in your previous posts...so show some code...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter and sort the file using awk

I have file and process it and provide clean output. input file Device Symmetrix Name : 000A4 Device Symmetrix Name : 000A5 Device Symmetrix Name : 000A6 Device Symmetrix Name : 000A7 Device Symmetrix Name : 000A8 Device Symmetrix Name : 000A9 Device Symmetrix Name ... (10 Replies)
Discussion started by: ranjancom2000
10 Replies

2. Shell Programming and Scripting

Using awk to sort a file alphabetically

I have a problem with my homework I need to create a shell script using #!bin/awk -f the script will output the file in an alphabetical order only words and after the word is : after that a space then , then it will be numbered each character by which line its been for example CB 92A A... (1 Reply)
Discussion started by: collapse
1 Replies

3. Shell Programming and Scripting

Want to sort a file using awk & sed to get required output

Hi All, Need Suggestion, Want to sort a file using awk & sed to get required, output as below, such that each LUN shows correct WWPN and FA port Numbers correctly: Required output: 01FB 10000000c97843a2 8C 0 01FB 10000000c96fb279 9C 0 22AF 10000000c97843a2 8C 0 22AF 10000000c975adbd ... (10 Replies)
Discussion started by: aix_admin_007
10 Replies

4. Solaris

How to sort df -h out put :

Hello every one , I am just trying to sort df -h out in a particular order to differentiate SAN disks and local disks .. does any body have any script or any useful command ?? thanks in advance .. (8 Replies)
Discussion started by: new2uniks
8 Replies

5. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

6. Shell Programming and Scripting

Awk - Count instances of a number in col1 and put results in a col2 (new) of diff file

I have 2 files as follows: filename1: : 6742 /welcome/mundial98_ahf1_404.htm 1020 6743 /welcome/mundial98_ahf1_404.htm 2224 6744 /welcome/mundial_ef1_404.htm 21678 6745 /welcome/mundial_if_404.htm 4236 6746 /welcome/mundial_lf1_404.htm 21678 filename2: 6746 894694763 1... (2 Replies)
Discussion started by: jontjioe
2 Replies

7. Shell Programming and Scripting

Put lines of a file in an array with awk

Hello, Is there any way in awk to put every line of a file in an array and so we can like this print the line we want. For example, if we have this file aaa eee bbb fff ccc ggg ddd hhh So we can print to the output the 3rd line only ccc ggg If it is possible, please put the... (7 Replies)
Discussion started by: rany1
7 Replies

8. Shell Programming and Scripting

awk pattern search and put in a file

hi I am doing a task that is i have to search for multiple pattern from a file's 9 th column and then redirect it to a new file awk -F, 'BEGIN {OSF=","} { if ($9 == "OTF") print $0}' test1.tsv > test.tsv and the patterns are OST. ODI,MIN LIKE OTF Bit not getting the desired output... (11 Replies)
Discussion started by: pranabrana
11 Replies

9. UNIX for Dummies Questions & Answers

awk: redrect printf to file and sort

{ printf "%s %6.2f\n", UserName, pay > payroll_report | sort -nk2 payroll_report; } this is what I have but it doesnt write the payroll_report file and gives a syntax error for the pipe...help?? (2 Replies)
Discussion started by: knc9233
2 Replies

10. Shell Programming and Scripting

Perl find::file can I sort the out put

Perl file::find can I sort the out put I am using file::find in my script but how I wish to process each file found in date order. Can I sort this module? eg part of current script is.... use File::Find; # Recursively find all files and directories in $mqueue_directory find(\&wanted,... (2 Replies)
Discussion started by: Andrek
2 Replies
Login or Register to Ask a Question