Sponsored Content
Full Discussion: Clean file in single action
Top Forums Shell Programming and Scripting Clean file in single action Post 302077115 by djp on Monday 19th of June 2006 04:57:34 PM
Old 06-19-2006
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!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

make and clean in a single rule in the makefile.

Hi, This stems from the following thread https://www.unix.com/showthread.php?t=18299 I have a makefile which makes either executables or a shared library. i.e. make -f unix.mak will create the executables and make -f unix.mak libolsv will create the shared library. Since these have to be... (4 Replies)
Discussion started by: vino
4 Replies

2. UNIX for Advanced & Expert Users

Clean Text File

HI, I have a file which comes from crystal reports in the below format. I need to clean the file so that i will only have the columns(deptid,empid,ename,sal) and the data below the column names. There is a bug in the repoting tool( we only see page1-1 for every department).The rundate change... (1 Reply)
Discussion started by: kris01752
1 Replies

3. UNIX for Advanced & Expert Users

Clean File

BeginDate 07/01/06 End: 07/31/06 Cust: A02991 - Burnham 0002000 5,829,773 145.3 0009701 4,043,850 267.3 2005000 286,785.13 100.0 BeginDate 07/01/06 End: 07/31/06 Cust: A01239 - East Track PSE Index A 0009902 317,356.82 890.2 0020021 ... (5 Replies)
Discussion started by: kris01752
5 Replies

4. UNIX for Dummies Questions & Answers

Clean directories by reading from file

I have a file in following format directory1=/out/log purgedays1=4 extn1=log,out,txt directory2=/clean/log purgedays2=4 extn2=log,out now i need need to create a script that reads this file and cleans all the files with the given extn from the given directory. The catch here is that... (2 Replies)
Discussion started by: max_payne1234
2 Replies

5. UNIX for Advanced & Expert Users

Unable to clean up file system

Hi, Has anyone ever encountered the following scenario: I am working on a SUN server with solaris 10 installed and veritas managing the filesystem. One of the file systems has become full: df -kh /ossrc/dbdumps Filesystem size used avail capacity Mounted on... (6 Replies)
Discussion started by: eeidel
6 Replies

6. UNIX for Dummies Questions & Answers

command to clean up file systems

As you will verify, I am a really naive user of AIX 5.1. As such I wonder if you could possibly let me know of a command or procedure I could use to automatically, globally and safely, remove all useless files from my machine. I'm not referring to my own files because I perfectly know which of them... (1 Reply)
Discussion started by: ahjchr
1 Replies

7. Shell Programming and Scripting

Take action if a particular file appears in a directory

This is my task - pls help Write a script that will run every 5 min and check if a particular file has appeared in a particular directory. Once it appears then rename the file and move it a bkp directory and run another script. (3 Replies)
Discussion started by: mrudula009
3 Replies

8. Shell Programming and Scripting

Opening file and executing an action

I want the script to read the directory I am running the script from and print the contents of any file that has GX in it's title. This is the code needed. But how do I combine it? #!/usr/bin/perl opendir(CURRENT,"."); @list = readdir(CURRENT); closedir(CURRENT); foreach $item (@list){... (4 Replies)
Discussion started by: DemonixX
4 Replies

9. Shell Programming and Scripting

Take action only if a file is X hours (or seconds) old

shell: #!/bin/ash I searched and found a few relevant posts (here and here - both by porter, on the same day (?)) however both are just a do while loop, I need to check a file date and compare it to the current time. I would like it to say if file 'test' is more than 12 hours old than "right... (3 Replies)
Discussion started by: phdeez
3 Replies

10. UNIX for Beginners Questions & Answers

Compare file name and take action

Have some files in /tmp/dir abc.zip 123.zip 345.zip and if name matches to 345.zip then take action My code.... am i doing something wrong ? Please advise. #!/bin/bash set -x cd /tmp/dir for i in *.* do if ] then (4 Replies)
Discussion started by: abhaydas
4 Replies
CipUX::CAT::Web::Module::ServerInfo(3pm)		User Contributed Perl Documentation		  CipUX::CAT::Web::Module::ServerInfo(3pm)

NAME
CipUX::CAT::Web::Module::ServerInfo - Lists all perl versions of CipUX VERSION
This document describes CipUX::CAT::Web::Module::ServerInfo version 3.4.0.3 SYNOPSIS
This CAT Web module can be used to see installed CipUX Perl module versions. DESCRIPTION
This CAT Web module can be used to see installed CipUX Perl module versions. INTERFACE
module Use this method to start the list. DIAGNOSTICS
Throws the error To use this module, please install Module::List::Pluggable! if Module::List::Pluggable is not installed. CONFIGURATION AND ENVIRONMENT
CipUX::CAT::Web::Module::ServerInfo requires no configuration files or environment variables. However it merges its configuration from CipUX::CAT::Web::Module and itself. DEPENDENCIES
Log::Log4perl CipUX::CAT::Web::Module Module::List::Pluggable INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. AUTHOR
Christian Kuelker "<christian.kuelker@cipworx.org>" LICENCE AND COPYRIGHT
Copyright (C) 2010, Christian Kuelker "<christian.kuelker@cipworx.org>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the GNU GPL licence version 2 or any later version. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.14.2 2012-12-07 CipUX::CAT::Web::Module::ServerInfo(3pm)
All times are GMT -4. The time now is 05:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy