[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: QOTD (question of the day)
On Friday, April 23, 2004, at 05:00 PM, <dsavage@peaknet.net> wrote:
> On Friday April 23, 2004 Ken Hagan <ken@alacrity-it.com> wrote:
>> cat <file> | cut -c 5-80
>> or something like that will give you columns 5 through 80.
>>
>> cut is your friend.
Or a shortened version:
cut -c 5- file
But the original question was to remove the numbers and the space:
On Friday, April 23, 2004, at 03:58 PM, <dsavage@peaknet.net> wrote:
> I want to strip away these line numbers. Depending on the number of
> lines
> in a file, there are either three digits or four followed by a space.
... or possibly 1 or 2 or 5 or more digits? Including the space?
Because of the variable length of initial digits, sed is the better
tool:
$ cat <<! | sed 's/^[^ ]* //'
N sourcecodetextsourcecodetextsourcecodetext
NN sourcecodetextsourcecodetextsourcecodetext
NNN sourcecodetextsourcecodetextsourcecodetext
NNNN sourcecodetextsourcecodetextsourcecodetext
NNNNN sourcecodetextsourcecodetextsourcecodetext
!
Regards,
- Robert
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.