How do I make the delimiter for cut be a single character with hex value 1e? I tried in a script file: DELIMITER='\x1e' DD=`echo $DATA | cut -f 1 --delimiter $DELIMITER` and it tells me: cut: the delimiter must be a single character Jerry
Jerry Geis wrote:> How do I make the delimiter for cut be a single character with hex value > 1e? > > I tried in a script file: > > DELIMITER='\x1e' > DD=`echo $DATA | cut -f 1 --delimiter $DELIMITER`use sed to substitute $DELIMITER to single character. DD=`echo $DATA | sed -e "s/$DELIMITER/\:/g" | cut -f 1 -d\:> > and it tells me: > cut: the delimiter must be a single character > > Jerry > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Diaa Radwan,RHCE -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20070112/d182492e/attachment-0001.sig>
Jerry Geis wrote:> How do I make the delimiter for cut be a single character with hex value > 1e? > > I tried in a script file: > > DELIMITER='\x1e' > DD=`echo $DATA | cut -f 1 --delimiter $DELIMITER` > > and it tells me: > cut: the delimiter must be a single character > > JerryIt appears that the line should be: DELIMITER=$'\x1e' Note the dollar sign before the apostrophe. I had to look it up in the bash man page as I knew there was a way to do it but I could not remember how. You will find the reference to it under QUOTING in the paragraph starting "Words of the form $?string? are treated specially." Hope that helps! -- Jay Leafey - Memphis, TN jay.leafey at mindless.com -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5177 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.centos.org/pipermail/centos/attachments/20070112/0178bacb/attachment-0001.bin>