Sponsored Content
Full Discussion: awk Command "HELP ME"
Top Forums UNIX for Dummies Questions & Answers awk Command "HELP ME" Post 302900805 by newme85 on Thursday 8th of May 2014 07:59:13 PM
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
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 04:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy