FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 04-30-2010, 02:46 PM
adrian kok
 
Default need help: about remove space

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 "

". 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



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-30-2010, 02:51 PM
Peter Hinse
 
Default need help: about remove space

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 "

". 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
> Patrick

Regards,

Peter

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-30-2010, 02:52 PM
Phil Schaffner
 
Default need help: about remove space

cat FileA | tr -s '
' > FileB
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-30-2010, 02:55 PM
Michel van Deventer
 
Default need help: about remove space

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 "

". 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



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 04:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org