Re: problem with awk
- From: Terry Polzin <foxec208@xxxxxxxxxx>
- Date: Wed, 02 Jun 2010 15:15:21 -0400
On Wed, 2010-06-02 at 13:44 -0500, Dave Ulrick wrote:
On Tue, 1 Jun 2010, Dave Ulrick wrote:I don't know that the FS should be declared in the BEGIN processing what
Looks like a field separator (FS) problem. The field separator is used by
'awk' to divide a line into fields. The default 'awk' field separator is
"\t" (tab) but your fields are separated by spaces. Try adding this inside
the BEGIN {} block:
FS = " ";
This would give you a script like this:
awk 'BEGIN { FS = " "; }
echo $2
END { print "Fin" }
' testclean
Alternatively, you may specify the field separator as an 'awk' option:
awk -F " " '<your script>' testclean
Oops! I zoomed in on the field separator issue without noticing that the
rest of your script isn't quite correct. Here's a one-liner that should
solve your stated problem:
awk -F "\t" '{print $2}' <filename>
This command will print the second tab-delimited field of every record of
a file.
Dave
--
Dave Ulrick
Email: d-ulrick@xxxxxxxxxxx
about
awk -F " " '{ print $2}' <file>
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
- Follow-Ups:
- screen res problem
- From: David Ocame
- screen res problem
- References:
- problem with awk
- From: Adel ESSAFI
- Re: problem with awk
- From: Dave Ulrick
- Re: problem with awk
- From: Dave Ulrick
- problem with awk
- Prev by Date: Re: can't set Okular as helper pdf app in Firefox
- Next by Date: Re: Relabeling all audio files on a server
- Previous by thread: Re: problem with awk
- Next by thread: screen res problem
- Index(es):
Relevant Pages
|