On Thu, Mar 18, 2004 at 08:07:24PM -0800, Cory Petkovsek wrote: > On Thu, Mar 18, 2004 at 03:13:09PM -0800, Jason wrote: > > I am an awk user by habit and would usually do an: > > > > $ awk -F: '{print $1}' /etc/passwd > > > > for this, but cut saves some typing and seems more > > logical for these cases where you don't need to do > > selective (regex) printing. > > What you typed is about the limit of my awk knowledge. Cut has the annoying > condition that delimeters are one character. So if there is some input: > happy.com OK > test.com REJECT > $ cut -f 2 -d \ <-- space after \ > Will print a space, specifically the 2nd space after the com on each column. > $ awk '{print $2}' > will print the OK and REJECT column.
Well, the default delimiter for cut is a tab. Cut can also select byte or character lists. So if your example always has the OK/REJECT column at character 14, then `cut -c 14-` would work for you. If all your characters are one byte, `cut -c 14` would work also. I think cut was originally written to be able select entries out of databases, which usually use a well defined delimiter or position, not just "any sequence of white space". -- <[EMAIL PROTECTED]> _______________________________________________ EuG-LUG mailing list [EMAIL PROTECTED] http://mailman.efn.org/cgi-bin/listinfo/eug-lug