awk Command "HELP ME"


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers awk Command "HELP ME"
# 1  
Old 05-08-2014
awk Command "HELP ME"

Hello everyone, i'm working on this project with a friend and we decided to split the project in half and i got the awk half (GREAT). so i have a list of states and people and i'm trying to write a command that will make end result look like this

California
Jenilee Harrison, San Francisco
Sam Karter, Los Angeles
Minnie Mouse, Anaheim
Florida
Gandalf Addison, Jupiter
Mickey Mouse, Orlando
Tawanda Rice, West Palm Beach
Adam Voter, Miami
Gollum Zeller, Tampa
Illinois
Zelda Bosco, Chicago
Milton Callahan, Schaumburg
Howard Messer, Orland Park
Ogden Nash, Berkeley
Penelope Ogden, Naperville
Indiana
Dominique Daniels, Gary
Susie Green, Indianapolis
Harvey Pelican, Michigan City
Byron Trapp, Indianapolis
Wisconsin
Vickie Edison, Milwaukee
Tom Furter, Milwaukee
Dave Ile, Madison
Waylon Jetson, Green Bay
Kendall Smith, Madison


I thought it would be fairly easy but i'm running into problems....this is what i have....

BEGIN { FS = "|" }
{ printf "%-40s %-20s %6.2f\n", $1, $2, $3, $4 }

but nothing happens

---------- Post updated at 06:59 PM ---------- Previous update was at 06:56 PM ----------

forgot to add what the files look like before


Florida:Mouse:Mickey:Orlando
California:Mouse:Minnie:Anaheim
Florida:Voter:Adam:Miami
Illinois:Bosco:Zelda:Chicago
Indiana:Green:Susie:Indianapolis
Wisconsin:Furter:Tom:Milwaukee
Wisconsin:IleSmilieave:Madison
California:Karter:Sam:Los Angeles
Illinois:Messer:Howard:Orland Park
Illinois:Nash:Ogden:Berkeley
Illinois:Ogden:Penelope:Naperville
Indiana:Pelican:Harvey:Michigan City
Florida:Rice:Tawanda:West Palm Beach
Wisconsin:Smith:Kendall:Madison
Indiana:Trapp:Byron:Indianapolis
Illinois:Callahan:Milton:Schaumburg
IndianaSmilieanielsSmilieominique:Gary
Wisconsin:Edison:Vickie:Milwaukee
Florida:Addison:Gandalf:Jupiter
Florida:Zeller:Gollum:Tampa
California:Harrison:Jenilee:San Francisco
Wisconsin:Jetson:Waylon:Green Bay
# 2  
Old 05-08-2014
It seems like your friend posted here as well, Help with sed Command

What a coincidence. For the sake of your projects, you should both coordinate better.

Regards,
Alister
This User Gave Thanks to alister For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk "date" and "system" command

Hello experts! I need your help please I have a file.txt of which I want to extract 3rd and 4th columns with date with the form e.g.: 2016-11-25 03:14:50and pass them to "date" command, but also append the 9th column in a file as well. So I want to execute date -d '2016-11-25 03:14:50' ... (2 Replies)
Discussion started by: phaethon
2 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

6. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

7. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

8. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

9. Shell Programming and Scripting

help for saving vertical datas to horizontal with "awk" or "cut"

hi, i have a file having datas like that ./a.txt 12344 12345 12346 12347 ..... ..... ... i want to save this datas to another file like that ./b.txt 12344 12345 12346 12347 ... ... ... i think awk can make this but how? :) waiting for ur help. (3 Replies)
Discussion started by: mercury
3 Replies

10. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question