Sponsored Content
Top Forums Shell Programming and Scripting Removing whitespace from files Post 37002 by Kelam_Magnus on Monday 9th of June 2003 02:21:00 PM
Old 06-09-2003
My personal fav for removing blank lines...not your question... but I thought it still might be relevant.

grep -v ^$ file.in > file.out

^ designates the beginning of the line.
$ designates the end of the line.

Now to your question.

awk '{ print $1 "\%" $2 "\%" $3 "\%" $4 ]' file.in > file.out
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing files

Hello all, I'd like to remove files which is returned by the following statement ls -l arch*.dbf|grep "`date|cut -c5-10`" (cut -c5-10 =Mar 20) To achive this,I tried the following statments but none worked .. rm < `ls -l arch*.dbf|grep "`date|cut -c5-10`"` rm `ls -l arch*.dbf|grep... (8 Replies)
Discussion started by: luft
8 Replies

2. Shell Programming and Scripting

removing whitespace from middle of file -help

I have a file in which I clean out a bunch of nonsense text as well as path information. What I end up with is something like the following: johnson.........................................................933 Where the periods represent the whitespace The file comes out originally with... (2 Replies)
Discussion started by: roninuta
2 Replies

3. Shell Programming and Scripting

removing old files except configuration files and folders

Dear all, I want to remove files older than 2 months in the /home/member directory. But except the configuration files (like .bash_profile .config/ .openoffice/ .local/ .kde/ etc..) I have tried with the command find . -mtime +60 -wholename './.*' -prune -o -print -exec mv {} \; but it... (1 Reply)
Discussion started by: jamcalicut
1 Replies

4. Shell Programming and Scripting

Copy files listed in a text file - whitespace problem.

Hi, Say I have this text file <copy.out> that contains a list of files/directories to be copied out to a different location. $ more copy.out dir1/file1 dir1/file2 dir1/file3 "dir1/white space" dir1/file4 If I do the following: $copy=`more copy.out` $echo $copy dir1/file1... (4 Replies)
Discussion started by: 60doses
4 Replies

5. Shell Programming and Scripting

Help with removing files

i have a directory that have files that contains word "spam", how can i remove all those files which have word spam. This code help me in searching find ./ -type f -exec grep -l "spam" {} \; How i will add removing option with it. If some one have good suggestion regarding searching... (2 Replies)
Discussion started by: learnbash
2 Replies

6. Shell Programming and Scripting

How to match (whitespace digits whitespace) sequence?

Hi Following is an example line. echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:" I want it's output to be 200 However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Discussion started by: shahanali
3 Replies

7. Shell Programming and Scripting

Removing whitespace issue

Hi, I have a file with rows like below delimited with pipe (|) I want to remove all the leading and trailing white space from each and every fields keeping the delimiter intact. I have tired this sed 's/*//g;s/*$//g' but the result is incorrect it is removing a whitespace from... (6 Replies)
Discussion started by: COD4
6 Replies

8. UNIX for Dummies Questions & Answers

Removing files

How do you delete/remove multiple files ? (5 Replies)
Discussion started by: nosuchluck
5 Replies

9. UNIX for Dummies Questions & Answers

Help in Removing the Old files

Hi Gurus, we are planning to clear the old log files based on the year and i need help on this and i searched in google and i came up with the scripts but i am stuck with this. (1) wroks fine How many files exist in based on the extension find -type f | sed -e 's/.*\.//' | sort | uniq... (1 Reply)
Discussion started by: SeenuGuddu
1 Replies

10. UNIX for Beginners Questions & Answers

Find and removing the old files and zipping the files using shell script

Hi, I am trying to removing the old files which were older than 10 days and same g zipping the files using the shell script. script was return as follows. find /jboss7_homes/JBOSS7/SKYLIV??/SKYLIV??_CRM/jboss-eap-7.0/standalone/log -mtime +10 -type f | xargs rm -f find /cer_skyliv??/log... (6 Replies)
Discussion started by: venkat918
6 Replies
UPSC(8) 							    NUT Manual								   UPSC(8)

NAME
upsc - example lightweight UPS client SYNOPSIS
upsc -l | -L [host] upsc ups [variable] upsc -c ups DESCRIPTION
upsc is provided as a quick way to poll the status of a UPS server. It can be used inside shell scripts and other programs that need UPS data but don't want to include the full interface. OPTIONS
-l host List all UPS names configured at host, one name per line. The hostname defaults to "localhost". You may optionally add a colon and a port number. -L host As above, list all UPS names configured at host, including their description provided by the remote upsd(8) from ups.conf(5). The hostname defaults to "localhost". You may optionally add a colon and a port number to override the default port. -c ups Lists each client connected on ups, one name per line. ups Display the status of that UPS. The format for this option is upsname[@hostname[:port]]. The default hostname is "localhost". variable Display the value of this variable only. By default, upsc retrieves the list of variables from the server and then displays the value for each. This may be useful in shell scripts to save an additional pipe into grep. EXAMPLES
To list all variables on an UPS named "myups" on a host called "mybox", with upsd(8) running on port 1234: $ upsc myups@mybox:1234 battery.charge: 100.0 battery.voltage: 13.9 battery.voltage.nominal: 13.6 . . . To list the UPSes configured on this system, along with their descriptions: $ upsc -L apc: Back-UPS 500 ppro2: Patriot Pro II To retrieve the status for all UPSes connected to mybox, using Bourne-shell syntax: $ for UPS in `upsc -l mybox:1234`; do upsc $UPS ups.status done To list clients connected on "myups": $ upsc -c myups 127.0.0.1 ::1 192.168.1.2 DIAGNOSTICS
upsc will either print a list of UPS names, a list of all supported variables and their values on the UPS, or an error message. If you receive an error, make sure you have specified a valid UPS on the command line, that upsd(8) is really running on the other host and that no firewalls are blocking you. HISTORY
Earlier versions of this program used the upsfetch library and UDP sockets to talk to upsd. This version of upsc uses the new upsclient library, which only talks TCP. This is why upsct no longer exists. SEE ALSO
upsd(8) INTERNET RESOURCES
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ Network UPS Tools 05/21/2012 UPSC(8)
All times are GMT -4. The time now is 04:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy