Hi all I have big file as below and would like to know how many line eg: wc -l file but can't figure out how to know If I type wc -l file, I only get the 1023 but it includes the space When I use cat file | tr -d "\r \n". it gives me "adrian alice......" I need it as fileB and then wc -l fileB. Thank you so much file === adrian alice Patrick file B ===== adrian alice Patrick
Am 30.04.2010 16:46, schrieb adrian kok:> I have big file as below > and would like to know how many line eg: wc -l file > but can't figure out how to know > > If I type wc -l file, I only get the 1023 but it includes the space > When I use cat file | tr -d "\r \n". it gives me "adrian alice......" > I need it as fileB and then wc -l fileB.grep -cv ^$ file> > Thank you so much > > file > ===> > adrian > > alice > > > Patrick > > > > file B > =====> > adrian > alice > PatrickRegards, Peter -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20100430/68df4fcb/attachment-0002.sig>
cat FileA | tr -s '\n' > FileB
Hi, On Fri, 2010-04-30 at 07:46 -0700, adrian kok wrote:> Hi all > > I have big file as below > and would like to know how many line eg: wc -l file > but can't figure out how to know > > If I type wc -l file, I only get the 1023 but it includes the space > When I use cat file | tr -d "\r \n". it gives me "adrian alice......" > I need it as fileB and then wc -l fileB. >If those lines between the names are empty lines you might try : cat bigfile | egrep -v '^$' | wc -l or if you want the names into a second file : cat bigfile | egrep -v '^$' > fileB Regards, Michel