bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cut -c or cut -b


From: Bob Proulx
Subject: Re: cut -c or cut -b
Date: Fri, 18 Nov 2005 19:33:10 -0700
User-agent: Mutt/1.5.9i

Please pardon my top posting.  I wanted to keep your example as intact
as possible and it was just large enough that I did not want to cut
into it.

I looked your posting over fairly carefully and I could not discern a
bug report from it.  I did not see any problem with it.  It looked
fine and reasonable to me.

What are you trying to report?  Please be specific.  What output did
you expect and what output did you get?  What version of the program
were you using?

  program --version

Are you reporting a problem with 'echo'?  In which case you should be
advised that the shell includes a built in version of echo.

  type echo

Be careful when using '[' and ']' with regards to echo.  Those are
special to the shell and may be expanded to match files.  Better to
either quote them or to use a different character as end markers such
as the ':' character or some such.

Be careful with quoting to avoid the shell's word splitting.  Because
you have not quoted the command arguments in your example I believe it
is confusing you in some way.

Frankly I doubt this has anything to do with the utils at all but
really is just a basic shell operation question.  Try fixing your
quotes and trying again.  Here is a suggestion.

  a=$(echo "     Joy     " | cut  -b0-) ; echo "[$a]"

Or more compactly as:

  echo "[$(echo "     Joy     " | cut  -b3-)]"

As an asside I see that you sent your message to bug-textutils which
may be an indication that you are using an old version of the
utilities.  You might want to consider upgrading.  The latest stable
version of coreutils is 5.93.  GNU coreutils is the union of
fileutils, textutils, and sh-utils.

  http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00058.html

I have re-addressed the mail to the current bug-coreutils.  Please
reply there instead of the old address.

Bob

De, Shounak wrote:
> uname -a
> Linux lxdev3m0 2.4.7-10smp #1 SMP Thu Sep 6 17:09:31 EDT 2001 i686 unknown
> 
> a=`echo "     Joy     " | cut  -b0-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -b1-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -b2-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -b3-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -b4-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -b5-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -b6-` ; echo [$a]
> [Joy ]
> a=`echo "     Joy     " | cut  -b7-` ; echo [$a]
> [oy ]
> 
> a=`echo "     Joy     " | cut  -c0-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -c1-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -c2-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -c3-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -c4-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -c5-` ; echo [$a]
> [ Joy ]
> a=`echo "     Joy     " | cut  -c6-` ; echo [$a]
> [Joy ]
> a=`echo "     Joy     " | cut  -c7-` ; echo [$a]
> [oy ]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]