Sponsored Content
Top Forums Shell Programming and Scripting awk -- sort out the out put file Post 302321701 by hegdeshashi on Tuesday 2nd of June 2009 12:56:10 AM
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..
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
GEOIP_REGION_BY_NAME(3) 						 1						   GEOIP_REGION_BY_NAME(3)

geoip_region_by_name - Get the country code and region

SYNOPSIS
array geoip_region_by_name (string $hostname) DESCRIPTION
The geoip_region_by_name(3) function will return the country and region corresponding to a hostname or an IP address. This function is currently only available to users who have bought a commercial GeoIP Region Edition. A warning will be issued if the proper database cannot be located. The names of the different keys of the returning associative array are as follows: o "country_code" -- Two letter country code (see geoip_country_code_by_name(3)) o "region" -- The region code (ex: CA for California) PARAMETERS
o $hostname - The hostname or IP address whose region is to be looked-up. RETURN VALUES
Returns the associative array on success, or FALSE if the address cannot be found in the database. EXAMPLES
Example #1 A geoip_region_by_name(3) example This will print the array containing the country code and region of the host example.com. <?php $region = geoip_region_by_name('www.example.com'); if ($region) { print_r($region); } ?> The above example will output: Array ( [country_code] => US [region] => CA ) PHP Documentation Group GEOIP_REGION_BY_NAME(3)
All times are GMT -4. The time now is 02:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy