LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-10-2008, 05:31 AM   #1
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,300

Rep: Reputation: 102Reputation: 102
Question Remove extra spaces in a line


Hi,

I need a help in deleting extra spaces in a text.

I have a huge file, a part of it is :-

Code:
    3 09/21/08 03:32:07 started  undef    mino Oracle           nmx004.wwdc.numonyx.com               Message Text : The Oracle session with the PID 1103 has a CPU time                              consuming of 999.00 minutes for the instance NCD.                              
   24 09/13/08 19:18:37 finished undef    mino Oracle           nmx002.wwdc.numonyx.com               Message Text : SID: psoft in install: /oracle/software error:                              ORA-1652: unable to extend temp segment by 128 in                              tablespace PSTEMP
   21 09/16/08 02:38:58 finished undef    mino Oracle           nmx005.wwdc.numonyx.com               Message Text : SID: hrqa in install: /oracle/software error:                              ORA-1652: unable to extend temp segment by 128 in                              tablespace PSTEMP
      10/08/08 17:34:44 undef    undef    warn OpC              eux1b3.wwdc.numonyx.com               Message Text : Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/msgi/7e6d68a0-8b3b-71d                              9-1958-a481e18f0000_data', policy name 'ESM_fs_opcmsg'                              and policy id '7e6d68a0-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/msgi/820f9d70-8b3b-71d                              9-1958-a481e18f0000_data', policy name                              'sy-opcmsg(1|3)' and policy id                              '820f9d70-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Ignoring the policies listed above. (OpC40-1899)
      10/08/08 17:34:44 undef    undef    warn OpC              eux1b3.wwdc.numonyx.com               Message Text : Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7be0751e-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'or-alertlog' and                              policy id '7be0751e-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c20bcfa-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-bootrc' and                              policy id '7c20bcfa-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c31d53a-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-cron' and                              policy id '7c31d53a-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c3ba452-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-dmesg' and                              policy id '7c3ba452-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c612506-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-ecc (Unix)'                              and policy id '7c612506-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c71c1b8-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-error' and                              policy id '7c71c1b8-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c798eb6-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-memory' and                              policy id '7c798eb6-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c7cc8ce-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-named' and                              policy id '7c7cc8ce-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c84682c-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-sendmail' and                              policy id '7c84682c-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/le/7c8a832e-8b3b-71d9-                              1958-a481e18f0000_data', policy name 'sy-syslog' and                              policy id '7c8a832e-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Ignoring the policies listed above. (OpC40-1899)
After, "Message Text : " , there are more space there than needed.





for e.g. Message Text is as:
Code:
Message Text : Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/0541172e-0264-                              71da-0c97-a481e10d0000_data', policy name                              'ST_HP_opcagt_version' and policy id                              '0541172e-0264-71da-0c97-a481e10d0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/61c66462-aa8b-                              71d9-0819-a481e11b0000_data', policy name 'sy-chkemc'                              and policy id '61c66462-aa8b-71d9-0819-a481e11b0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8709366a-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'fc-check'                              and policy id '8709366a-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8729c1d2-8b3b-                              71d9-1958-a481e18f0000_data', policy name                              'or-apachkproc' and policy id                              '8729c1d2-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/872dabd0-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-check'                              and policy id '872dabd0-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8730b8c0-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkarch'                              and policy id '8730b8c0-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/873446e8-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkdba'                              and policy id '873446e8-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8737824a-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkdef'                              and policy id '8737824a-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/873a608c-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkjob'                              and policy id '873a608c-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/873fd2ce-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chklock'                              and policy id '873fd2ce-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8742873a-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkpen'                              and policy id '8742873a-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/87459164-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkproc'                              and policy id '87459164-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/87497a36-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chksess'                              and policy id '87497a36-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/874ca972-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'or-chkuse'                              and policy id '874ca972-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/87525516-8b3b-                              71d9-1958-a481e18f0000_data', policy name                              'or-iaschkproc' and policy id                              '87525516-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/87555482-8b3b-                              71d9-1958-a481e18f0000_data', policy name                              'or-jvchkproc' and policy id                              '87555482-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8757e33c-8b3b-                              71d9-1958-a481e18f0000_data', policy name                              'or-namesproc' and policy id                              '8757e33c-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/87b625d2-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'pa-check'                              and policy id '87b625d2-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/88216eb4-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-bckchk'                              and policy id '88216eb4-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/88255eb6-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-check'                              and policy id '88255eb6-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/88363394-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-check1'                              and policy id '88363394-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/8850c11e-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-check2'                              and policy id '8850c11e-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/88570a9c-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-check3'                              and policy id '88570a9c-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/885fddc0-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-chkxp'                              and policy id '885fddc0-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/88632606-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-cluster'                              and policy id '88632606-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/88771a8a-8b3b-                              71d9-1958-a481e18f0000_data', policy name                              'sy-security' and policy id                              '88771a8a-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/887db2a0-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'sy-test'                              and policy id '887db2a0-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Cannot load policy. Reason: (conf-33) Could not                              validate the signature for policy data file                              '/var/opt/OV/datafiles/policies/monitor/888d1fce-8b3b-                              71d9-1958-a481e18f0000_data', policy name 'tz-check'                              and policy id '888d1fce-8b3b-71d9-1958-a481e18f0000'.                                (OpC40-1867)                              Ignoring the policies listed above. (OpC40-1899)

However, I need to remove extra spaces in a single line, like this.
Code:
Message Text : Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/0541172e-0264-71da-0c97-a481e10d0000_data', policy name 'ST_HP_opcagt_version' and policy id '0541172e-0264-71da-0c97-a481e10d0000'. (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/61c66462-aa8b-71d9-0819-a481e11b0000_data', policy name 'sy-chkemc' and policy id '61c66462-aa8b-71d9-0819-a481e11b0000'. (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/8709366a-8b3b- 71d9-1958-a481e18f0000_data', policy name 'fc-check' and policy id '8709366a-8b3b-71d9-1958-a481e18f0000'. (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/8729c1d2-8b3b-71d9-1958-a481e18f0000_data', policy name 'or-apachkproc' and policy id '8729c1d2-8b3b-71d9-1958-a481e18f0000'. (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/872dabd0-8b3b-71d9-1958-a481e18f0000_data', policy name 'or-check'  and policy id '872dabd0-8b3b-71d9-1958-a481e18f0000'. (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/8730b8c0-8b3b- 71d9-1958-a481e18f0000_data', policy name 'or-chkarch' and policy id '8730b8c0-8b3b-71d9-1958-a481e18f0000'.  (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file   '/var/opt/OV/datafiles/policies/monitor/873446e8-8b3b- 71d9-1958-a481e18f0000_data', policy name 'or-chkdba' and policy id '873446e8-8b3b-71d9-1958-a481e18f0000'. (OpC40-1867)  Cannot load policy. Reason: (conf-33) Could not  validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/8737824a-8b3b- 71d9-1958-a481e18f0000_data', policy name 'or-chkdef'  and policy id '8737824a-8b3b-71d9-1958-a481e18f0000'. OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/873a608c-8b3b- 71d9-1958-a481e18f0000_data', policy name 'or-chkjob' and policy id '873a608c-8b3b-71d9-1958-a481e18f0000'.  (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not validate the signature for policy data file '/var/opt/OV/datafiles/policies/monitor/873fd2ce-8b3b- 71d9-1958-a481e18f0000_data', policy name 'or-chklock' and policy id '873fd2ce-8b3b-71d9-1958-a481e18f0000'.  (OpC40-1867) Cannot load policy. Reason: (conf-33) Could not  validate the signature for policy data file ..........
I am sorry, you may find it little difficult to read, as this is very long line.


I have come across a code, this works fine for such cases.
Code:
sed -e 's/  */ /g'
But, what I need that this should apply to text which comes after "Message Text :"

Thanks in adv,

Regards,
VIKAS
 
Old 10-10-2008, 06:49 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Hi.

It's a bit long-winded, and you can probably do it all in sed somehow, but here's how I'd do it (assuming your file's called 'infile', and _every_ line contains the 'Message Text : ' string):

1) Split the lines at 'Message Text :" and dump the left side into a file:
Code:
# awk -F"Message Text :" '{print $1}' infile > left
2) Re-add "Message Text :' to the end of the lines:
Code:
# sed -i 's/$/Message Text :/' left
3) Grab the text to the right of 'Message Text :':
Code:
# awk -F"Message Text :" '{print $2}' infile > right
4) Strip out the double spaces:
Code:
# sed -i 's/  */ /g' right
5) Recombine the left and right sides:
Code:
# paste -d' ' left right > outfile
'outfile' should contain what you want.

Dave
 
Old 10-10-2008, 07:06 AM   #3
burschik
Member
 
Registered: Jul 2008
Posts: 159

Rep: Reputation: 31
This is a bit simpler:

Code:
awk -F'Message text:' '{ gsub(/ +/, " ", $2); print $1 "Message text:" $2; }'
 
Old 10-10-2008, 07:08 AM   #4
burschik
Member
 
Registered: Jul 2008
Posts: 159

Rep: Reputation: 31
Oh, and please don't EVER post long lines like that again. I spent minutes scrolling around the page to find the buttons.
 
Old 10-10-2008, 07:14 AM   #5
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
gsub. Why do I never remember gsub?
 
Old 10-10-2008, 09:22 AM   #6
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,300

Original Poster
Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by burschik View Post
Oh, and please don't EVER post long lines like that again. I spent minutes scrolling around the page to find the buttons.
Dear burschik,

I am sorry, but this it has to be like this to give a clear picture.
Alternatively, if you had problems finding your buttons, you could simply go back to previous page of the browser.

Regards,
VIKAS
 
Old 10-10-2008, 09:25 AM   #7
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,300

Original Poster
Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by ilikejam View Post
Hi.

It's a bit long-winded, and you can probably do it all in sed somehow, but here's how I'd do it (assuming your file's called 'infile', and _every_ line contains the 'Message Text : ' string):

1) Split the lines at 'Message Text :" and dump the left side into a file:
Code:
# awk -F"Message Text :" '{print $1}' infile > left
2) Re-add "Message Text :' to the end of the lines:
Code:
# sed -i 's/$/Message Text :/' left
3) Grab the text to the right of 'Message Text :':
Code:
# awk -F"Message Text :" '{print $2}' infile > right
4) Strip out the double spaces:
Code:
# sed -i 's/  */ /g' right
5) Recombine the left and right sides:
Code:
# paste -d' ' left right > outfile
'outfile' should contain what you want.

Dave
Works perfect, exactly what I was looking for.
And thanks a million for posting comments too. Will make a note of it.

Regards,
VIKAS
 
Old 10-10-2008, 10:04 AM   #8
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,300

Original Poster
Rep: Reputation: 102Reputation: 102
Code:
sed '/^Message Text/ { s/[[:space:]]\{2,\}/ /g }'
This too works fine.
 
Old 10-11-2008, 04:01 AM   #9
burschik
Member
 
Registered: Jul 2008
Posts: 159

Rep: Reputation: 31
Quote:
Originally Posted by vikas027 View Post
Dear burschik,

I am sorry, but this it has to be like this to give a clear picture.
Alternatively, if you had problems finding your buttons, you could simply go back to previous page of the browser.

Regards,
VIKAS

Yeah, ok, I see your problem. But going back to another page will not help me find the submit button for this reply, for example.
 
Old 10-11-2008, 04:04 AM   #10
burschik
Member
 
Registered: Jul 2008
Posts: 159

Rep: Reputation: 31
Quote:
Originally Posted by vikas027 View Post
Code:
sed '/^Message Text/ { s/[[:space:]]\{2,\}/ /g }'
This too works fine.
How is this supposed to work? If it does, then I must have totally misunderstood your problem.
 
Old 10-11-2008, 08:19 AM   #11
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,874

Rep: Reputation: 554Reputation: 554Reputation: 554Reputation: 554Reputation: 554Reputation: 554
Here's a shell solution
# Eliminate extra whitespace function:
crunch() {
while read FOO ; do
echo $FOO
done
}

echo $LINE | crunch
or cat filename |crunch > nowhite.filename
 
Old 10-11-2008, 09:20 AM   #12
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
vikas027,

There is a way around long lines in a "Code:" block: put it in a pastebin.
(See the Wikipedia if you don't know what that is.)

I'm not going to even consider helping you until you fix the problem.


All,
One way around the posting problem is to use a recent version of konqueror which has the
"Access Keys" feature.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
remove xtra spaces lipun4u Linux - Newbie 2 09-16-2008 02:56 AM
remove all spaces from a line in C xeon123 Programming 12 10-23-2007 02:29 AM
How to remove spaces from a string pawan_songara Programming 14 08-30-2006 10:20 PM
Is it possible to remove spaces Alex_jacobson Linux - General 4 01-16-2005 11:45 AM
Html: Extra Spaces on Top mikeshn Programming 1 07-05-2003 04:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration