Field Separator
Author Message
Field Separator

Hello,

I am trying to set several numbers as Field Separators (2,4 and 6).
However, the following primitives don't seem to work:
FS = "2|4|6"
FS = "[246]"

Why doesn't it work ?
How can I achieve it ?

Thank you

Marco Gouveia

Sat, 06 Dec 2003 15:54:15 GMT
Field Separator

Quote:

> I am trying to set several numbers as Field Separators (2,4 and 6).
> However, the following primitives don't seem to work:

>       FS = "2|4|6"
>       FS = "[246]"

> Why doesn't it work?

They both work for me using gawk ...

\$ echo 1234567 | gawk 'BEGIN { FS = "2|4|6" } { print \$1, \$2, \$3, \$4 }'
1 3 5 7
\$ echo 1234567 | gawk 'BEGIN { FS = "[246]" } { print \$1, \$2, \$3, \$4 }'
1 3 5 7
\$

... and MKS awk:

C:/>echo 1234567 | awk 'BEGIN { FS = "2|4|6" } { print \$1, \$2, \$3, \$4 }'
1 3 5 7
C:/>echo 1234567 | awk 'BEGIN { FS = "[246]" } { print \$1, \$2, \$3, \$4 }'
1 3 5 7
C:/>

Quote:
> How can I achieve it?

Set the value of FS within a BEGIN rule. Use the character class, not
alternation.

--
Jim Monty

Tempe, Arizona USA

Sat, 06 Dec 2003 23:53:05 GMT
Field Separator

Quote:

>I am trying to set several numbers as Field Separators (2,4 and 6).
>However, the following primitives don't seem to work:
>     FS = "2|4|6"
>     FS = "[246]"

>Why doesn't it work ?
>How can I achieve it ?

Where are you putting this? If on the command line, try removing spaces
around the equal signs, e.g.,

awk 'your-script-here' FS="[246]" your-input-file

If you tried using these inside a BEGIN block, they should have worked.
What's your OS and awk version? What do your script and command line look
like?

Sun, 07 Dec 2003 03:38:01 GMT
Field Separator
I don't know how to get the version, but I was using /usr/bin/awk.
I just found out that if I use /usr/xpg4/bin/awk it works!!

Thank you.

Regards,

Marco

Quote:

>>I am trying to set several numbers as Field Separators (2,4 and 6).
>>However, the following primitives don't seem to work:
>>     FS = "2|4|6"
>>     FS = "[246]"

>>Why doesn't it work ?
>>How can I achieve it ?

>Where are you putting this? If on the command line, try removing spaces
>around the equal signs, e.g.,

>awk 'your-script-here' FS="[246]" your-input-file

>If you tried using these inside a BEGIN block, they should have worked.
>What's your OS and awk version? What do your script and command line look
>like?

Sun, 07 Dec 2003 14:58:09 GMT
Field Separator

Quote:

>I don't know how to get the version, but I was using /usr/bin/awk.
>I just found out that if I use /usr/xpg4/bin/awk it works!!

Old awk accepts only a single character as FS.  Newer awks
accept regular expressions.

Chuck Demas

Quote:

>>>I am trying to set several numbers as Field Separators (2,4 and 6).
>>>However, the following primitives don't seem to work:
>>>     FS = "2|4|6"
>>>     FS = "[246]"

>>>Why doesn't it work ?
>>>How can I achieve it ?

>>Where are you putting this? If on the command line, try removing spaces
>>around the equal signs, e.g.,

>>awk 'your-script-here' FS="[246]" your-input-file

>>If you tried using these inside a BEGIN block, they should have worked.
>>What's your OS and awk version? What do your script and command line look
>>like?

--
Eat Healthy    |   _ _   | Nothing would be done at all,

Die Anyway     |    v    | That no one could find fault with it.

Sun, 07 Dec 2003 16:52:57 GMT
Field Separator
Quote:

> I don't know how to get the version, but I was using /usr/bin/awk.

[SNIP]

Michael Heiming
[SNIP]

Mon, 08 Dec 2003 05:19:23 GMT
Field Separator

Quote:

> > I don't know how to get the version, but I was using /usr/bin/awk.

Nope. That's a GNU awk command-line option, and Marco is using the
awk and nawk supplied with SunOS/Solaris. The answers to his question
about which versions of awk he has available to him on his system
can probably best be found in the man pages awk(1) and nawk(1).

--
Jim Monty

Tempe, Arizona USA

Mon, 08 Dec 2003 06:36:40 GMT
Field Separator

Quote:

> > I don't know how to get the version, but I was using /usr/bin/awk.
> [SNIP]

> Michael Heiming
> [SNIP]

What's the big deal about top posting?

Tue, 09 Dec 2003 02:25:52 GMT
Field Separator

Quote:

> > > I don't know how to get the version, but I was using /usr/bin/awk.
> > [SNIP]
> > What about 'awk --version'?
> > Please don't top post.

> > Michael Heiming
> > [SNIP]

> What's the big deal about top posting?

It makes IMHO following of a thread much harder.

Btw. Jim Monty was of course right that '--version'
is a GNU (g)awk option. However, the awk that comes with
Solaris is the worst awk, I ever saw on any UNIX...:-(

Michael Heiming

Tue, 09 Dec 2003 03:53:42 GMT
Field Separator

Quote:

> > > > I don't know how to get the version, but I was using /usr/bin/awk.
> > > [SNIP]
> > > What about 'awk --version'?
> > > Please don't top post.

> > > Michael Heiming
> > > [SNIP]

> > What's the big deal about top posting?

> It makes IMHO following of a thread much harder.

And it's good proof that your email/news software wasn't well designed.
And in turn -- it shows _your_  cluelessness (<- it's english??).
Don't pay for someone-else's faults (especially when using Lookout ;)

Quote:
> Btw. Jim Monty was of course right that '--version'
> is a GNU (g)awk option. However, the awk that comes with
> Solaris is the worst awk, I ever saw on any UNIX...:-(

Yes. Using nawk(1) as default awk is a partial solution only.
be a good idea. gawk seems to be a kind of vim in vi world for me (or
even emacs ;>

Tue, 09 Dec 2003 21:17:43 GMT
Field Separator

Quote:

> > > What's the big deal about top posting?

> > It makes IMHO following of a thread much harder.

Firstly, why should a thread be harder to follow with a top post?

Quote:
> And it's good proof that your email/news software wasn't well designed.
> And in turn -- it shows _your_  cluelessness (<- it's english??).
> Don't pay for someone-else's faults (especially when using Lookout ;)

I have no problems showing cluelessness if I want to get an answer to
something I don't know.  For that matter anyone who posts a question here is
clueless - so what.

Secondly, Composer allows you to choose where the response goes and any good
email/news sware should make it easy to follow a thread by giving you a tree
structure with the posts so you don't even have to know what was said below a
response.

Personally, I find it bothersome to have to scroll down to get to the response
with every single prior post above.  I already know what's gone on prior to
the response, so unless someone is responding to a specific section of a post
it seems unnecessary to respond below it.

Wed, 10 Dec 2003 03:33:04 GMT
Field Separator

Quote:

> > > > What's the big deal about top posting?

> > > It makes IMHO following of a thread much harder.

> Firstly, why should a thread be harder to follow with a top post?

Look at this one :)

Quote:
> > And it's good proof that your email/news software wasn't well designed.
> > And in turn -- it shows _your_  cluelessness (<- it's english??).
> > Don't pay for someone-else's faults (especially when using Lookout ;)

> I have no problems showing cluelessness if I want to get an answer to
> something I don't know.  For that matter anyone who posts a question here is
> clueless - so what.

Point for you. And (your case) sorry for (indirect) calling _you_ "clueless"...
Next chunk shows why I'm sorry... vvvvvv

Quote:
> Secondly, Composer allows you to choose where the response goes and any good
> email/news sware should make it easy to follow a thread by giving you a tree
> structure with the posts so you don't even have to know what was said below a
> response.

Homework done ;) But what if you just started to browse particular NG? You can of course fetch everything etc.etc.
Quoting makes NG fat, but a bit more readable...

Quote:
> Personally, I find it bothersome to have to scroll down to get to the response
> with every single prior post above.  I already know what's gone on prior to
> the response, so unless someone is responding to a specific section of a post
> it seems unnecessary to respond below it.

Personally.  NewsGROUP are public. That's the difference.
At least read the Jargon File.

BTW. Would you mind to continue this thread using "private channel" (if at
all)?
--

Written at:
. # . .
. # . .
# . # .
. . . #

Wed, 10 Dec 2003 05:10:21 GMT
Field Separator
Infrequently it is acceptable to top post, for instance,
to say that, although this response is off-topic, it may
be the only place clueless newbies (or oldbies) will
encounter these ideas.

Or to say that of the two kinds of cluelessness (stupidity
and ignorance), there is a remedy for the second.

Quote:

> > > > What's the big deal about top posting?

> > > It makes IMHO following of a thread much harder.
> a top post?

For the same reason that a movie that is a series of
progressively more distant flashbacks may be harder to
narrative.  Perhaps that is why, of all movies ever
made, only "Memento" (any others?) has used this ordering.

The ultimate logical conclusion for those who would
rather see top posting would be a simple awk script
to reverse the message before it is sent--last character
first, then next to last character, and so on.  Might
as well use rot-13, too.  OTOH, if the point is to make
the dialogue easy (rather than difficult) to follow,
replying in dialog order, or idea by idea, makes more
sense.

Quote:
> Personally, I find it bothersome to have to scroll down
> to get to the response with every single prior post above.

Use the Ctrl-End combination, then scroll *up*.    ;-)>

But, seriously, one may be clueless about the dialogue because
one has subscribed after a thread has started, because ones
news server (mal)administrator is also clueless, or because
one can't or won't consult a list archive.  And it would be
nice to leave an unconfused, unconfounding record in the
archive for those others who in the future may find themselves
clueless about a topic to which you may contribute.

Quote:
> I already know what's gone on prior to
> the response,

FAQ, so that the clueless described above could write you to
joking, folks--DO NOT write Mr. Altman!]

It is "bothersome to have to scroll down" through gratuitous
quotation.  That is why everyone is encouraged to *prune*
*ruthlessly* according to Einstein's dictate--make everything
as simple as possible, but no simpler--leaving just enough
to form a coherent dialogue.

Regards,
--
Chris Johansen

Sat, 13 Dec 2003 06:20:47 GMT
Field Separator
Infrequently it is acceptable to top post, for instance,
to say that, although this response is off-topic, it may
be the only place clueless newbies (or oldbies) will
encounter these ideas.

Or to say that of the two kinds of cluelessness (stupidity
and ignorance), there is a remedy for the second.

Quote:

> > > > What's the big deal about top posting?

> > > It makes IMHO following of a thread much harder.
> a top post?

For the same reason that a movie that is a series of
progressively more distant flashbacks may be harder to
narrative.  Perhaps that is why, of all movies ever
made, only "Memento" (any others?) has used this ordering.

The ultimate logical conclusion for those who would
rather see top posting would be a simple awk script
to reverse the message before it is sent--last character
first, then next to last character, and so on.  Might
as well use rot-13, too.  OTOH, if the point is to make
the dialogue easy (rather than difficult) to follow,
replying in dialog order, or idea by idea, makes more
sense.

Quote:
> Personally, I find it bothersome to have to scroll down
> to get to the response with every single prior post above.

Use the Ctrl-End combination, then scroll *up*.    ;-)>

But, seriously, one may be clueless about the dialogue because
one has subscribed after a thread has started, because ones
news server (mal)administrator is also clueless, or because
one can't or won't consult a list archive.  And it would be
nice to leave an unconfused, unconfounding record in the
archive for those others who in the future may find themselves
clueless about a topic to which you may contribute.

Quote:
> I already know what's gone on prior to
> the response,

FAQ, so that the clueless described above could write you to
joking, folks--DO NOT write Mr. Altman!]

It is "bothersome to have to scroll down" through gratuitous
quotation.  That is why everyone is encouraged to *prune*
*ruthlessly* according to Einstein's dictate--make everything
as simple as possible, but no simpler--leaving just enough
to form a coherent dialogue.

Regards,
--
Chris Johansen

Sat, 13 Dec 2003 06:23:44 GMT

 Page 1 of 2 [ 15 post ]

Relevant Pages