LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-16-2008, 02:34 AM   #1
lipun4u
Member
 
Registered: Sep 2008
Location: Mumbai, india
Distribution: ubuntu and hp-unix
Posts: 118

Rep: Reputation: 15
remove xtra spaces


I want to remove extra spaces from grep command so that in can be fed to cut command.

ps -aux | grep nmap

is it possible ???
 
Old 09-16-2008, 02:43 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
You could use awk instead, it doesn't mind how many spaces you have.
 
Old 09-16-2008, 02:56 AM   #3
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
But you should be able to pipe through sed and remove multiple spaces.

Edit - try this

Code:
ps aux | grep nmap | sed -e 's/  */ /g'

Last edited by billymayday; 09-16-2008 at 03:36 AM.
 
  


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 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
please help me remove the spaces in filenames in a directory! asilentmurmur Linux - Newbie 3 07-14-2006 08:17 PM
Is it possible to remove spaces Alex_jacobson Linux - General 4 01-16-2005 11:45 AM
Terminal - Xtra Spaces Generated RH 8 gakusei Linux - Software 3 02-16-2003 07:34 PM


All times are GMT -5. The time now is 08:21 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