The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perform action file name written to the pipe fed.linuxgossip Shell Programming and Scripting 2 07-23-2008 07:38 AM
Clean File kris01752 UNIX for Advanced & Expert Users 5 09-28-2006 07:40 AM
Clean Text File kris01752 UNIX for Advanced & Expert Users 1 08-24-2006 11:48 AM
Compare 2 different file version and prompt for action systemali Shell Programming and Scripting 0 03-19-2006 11:58 PM
make and clean in a single rule in the makefile. vino UNIX for Dummies Questions & Answers 4 04-26-2005 10:12 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-19-2006
djp djp is offline
Registered User
 

Join Date: Apr 2005
Posts: 13
Clean file in single action

What one finds challenging another finds simple...

(HPUX B.11.11)

I have a text file named something like 12345.dst that could look like this:

DOG
CAT
NONE
TEST
CAT


What I want to end up with is 12345.dst looking like this:

CAT
DOG
TEST


removing "NONE" should it be there and doing the equivalent of "sort -u" on the remains. I know how to get out the "NONE" in a one-liner:

/bin/echo "g/^NONE$/d\nwq!" | ex -s 12345.dst

Is there a way to add in the functional equivalent of a "sort -u" to this command line?

Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 06-19-2006
Registered User
 

Join Date: May 2006
Location: Vancouver, BC
Posts: 11
Have you thought about:

grep -v -w NONE 12345.dst |sort -u
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0