emacs-bug-tracker
[Top][All Lists]
Advanced

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

[Emacs-bug-tracker] bug#7076: closed (Command required)


From: GNU bug Tracking System
Subject: [Emacs-bug-tracker] bug#7076: closed (Command required)
Date: Mon, 20 Sep 2010 21:19:02 +0000

Your message dated Mon, 20 Sep 2010 15:21:18 -0600
with message-id <address@hidden>
and subject line Re: bug#7076: Command required
has caused the GNU bug report #7076,
regarding Command required
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
7076: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7076
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Command required Date: Mon, 20 Sep 2010 15:10:48 +0500

How can we extract few characters from second or third line of a text file using cut command of Linux OS?

 

For example: to get 7-10 characters from 3rd line of a text file is required, what can be the command?

 

 

Regards,

 

Imran

 

This E-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this E-mail in error please notify the sender or mailto:address@hidden This E-mail message and attachment, if any, has been scanned for all known viruses, however we advice the recipient to check this E-mail and any attachments for the presence of viruses, UBL accepts no liability for any damage caused by any virus transmitted by this E-mail. Further, e-mail transmission is not guaranteed as error-free. UBL therefore does not accept liability for any errors or omissions in the contents of any messages that arise out of e-mail transmission.

--- End Message ---
--- Begin Message --- Subject: Re: bug#7076: Command required Date: Mon, 20 Sep 2010 15:21:18 -0600 User-agent: Mutt/1.5.20 (2009-06-14)
Imran Shoaib wrote:
> How can we extract few characters from second or third line of a text
> file using cut command of Linux OS?

In the future please send discussion questions concerning the
coreutils to the coreutils mailing list instead of the bug-coreutils.
The bug-coreutils mailing list is for bug reports only and every email
message opens up a bug in the bug tracking system.  I am closing this
bug report but discussion may continue.  Thanks.

A good place for general help questions is address@hidden

> For example: to get 7-10 characters from 3rd line of a text file is
> required, what can be the command?

I would use sed for this.  Don't print by default (-n) and then print
the 3rd line.

  $ printf "1234567890\n1234567890\n1234567890\n" | sed -n 3p

If you want specific characters then you can delete the unwanted
ones.  This is a contrived example:

  $ printf "1234567890\n1234567890\n1234567890\n" | sed -n 
'3{s/^..\(..\).*/\1/;p;}'

Or you can chain commands together.  Print only the third line to a
command that pulls apart fields.

  $ printf "11 12 13\n21 22 23\n31 32 33\n" | awk 'NR==3{print$2}'
  32

  $ printf "11 12 13\n21 22 23\n31 32 33\n" | awk 'NR==3{print $2, $3}'
  32 33

> This E-mail and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to which
> they are addressed. If you have received this E-mail in error

In the future please do not include such useless and annoying
disclaimers in your email.  The terms are incompatible with a free
software mailing list.  If you cannot avoid this then please use one
of the many free email providers on the network.

Bob


--- End Message ---

reply via email to

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