bug-textutils
[Top][All Lists]
Advanced

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

cut -c -b (UNCLASSIFIED)


From: Kirby, Jason B Mr NISA-DC/RABA Techhnologies
Subject: cut -c -b (UNCLASSIFIED)
Date: Wed, 28 Jul 2004 11:26:06 -0400

Classification:  UNCLASSIFIED 
Caveats: NONE

Hello,

cut needs something and this email is about that.

users of cut -c17-18,20-22,28-33 need output to come out with tabs as
abc     def     ghi   
or spaces
abc def ghi
or user defined -d:
abc:def:ghi
not
abcdefghi
as it does now with the fields *pasted* together.

That's the reqeust. A long explanation follows about why other attempted
alternatives are insufficient to cover what is being requested here.
Thanks,
Jason

I can't use cut -f with delimiter because field separation is inconsistent,
sometimes nonexistent.
Example:
0200(ECKD) at ( 94:  0) is dasda      : active at blocksize: 4096, 600840
blocks, 2347 MB
129e(ECKD) at ( 94:100) is dasdz      : active at blocksize: 4096, 601020
blocks, 2347 MB
I want "94" as field one, "0" and "100" as field two, and "dasda" and
"dasdz" as field three.

There are two colons that give me the following when I use awk so awk is no
option. :
cat /proc/dasd/devices | awk -F: '{ print $1":" $2  }'
129d(ECKD) at ( 94: 96) is dasdy
129e(ECKD) at ( 94:100) is dasdz
The output colon is provided by me.
when I use spaces as delimiter it looks even worse.

awk $4
94:
94:
94:100)
94:104)
there is a space after 94: creating a delimited situation that doesn't exist
when the number after 94 reaches 100 and above taking away that space
and making the second field indistinguishable from the first.

awk $4 $5
94:92)
94:96)
94:100)is
94:104)is
This way I could strip off )is  but still want to capture dasda that comes
later. Added headache.

The cleanest way to get the fields is with cut since I can count on columnar
consistency.
cat /proc/dasd/devices |  cut -c17-18,20-22,28-33
94 92dasdx
94 96dasdy
94100dasdz
94104dasdaa
94108dasdab
Isn't it a bug to have the -c list come out not separated by something? It
would be different if I had one range but some folks have several
comma-separated ranges who don't want them "paste"d  together. see man paste

I can tr out the spaces.  The problem is how to get the output separated by
delimiters of my choice.
I'd like to see:
94: 92:dasdx
94: 96:dasdy
94:100:dasdz
94:104:dasdaa
94:108:dasdab
But cut will not allow me to output delimiter unless I'm using -f which I
showed earlier won't work for me. If cut -f would work so would awk. Neither
do.
Hence my request.


Classification:  UNCLASSIFIED 
Caveats: NONE



reply via email to

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