Sponsored Content
Top Forums Shell Programming and Scripting Help removing output from .sh script Post 302842453 by pure_jax on Friday 9th of August 2013 10:08:57 AM
Old 08-09-2013
Help removing output from .sh script

I have the following script
Code:
#!/bin/ksh
# **********************************************************************
#
# System:       xxxx
#
# Filename:     List_Largest_Files.sh
#
# Purpose:      List 10 largest files in current partition
#
# Modification History:
# 1.0                    Initial Version
# ************************************************************************
du -sk ./* | sort -rn | head | \
while read SIZE ENTRY
do
# if size > 1048576 then it is at least 1 GB big
if [ ${SIZE} -gt 1048576 ]
then
NEWSIZE=`echo "${SIZE}000 / 1048576" | bc | sed -e "s/\(...\)$/\.\1/"`
printf "% 10s %s\n" "${NEWSIZE} GB" $ENTRY
# if size > 1024 then it is at least 1 MB big
elif [ ${SIZE} -gt 1024 ]
then
NEWSIZE=`echo "${SIZE}000 / 1024" | bc | sed -e "s/\(...\)$/\.\1/"`
printf "% 10s %s\n" "${NEWSIZE} MB" $ENTRY
else
printf "% 10s %s\n" "${SIZE} KB" $ENTRY
fi
done

The output is as follows: -

Code:
432 KB  ./old_scripts
72 KB ./deploy_file_mar_2007_Pilot.sh

Is there a way to remove the ./ from the output so it looks like: -

Code:
432 KB old_scripts
72 KB deploy_file_mar_2007_Pilot.sh

I have tried du -sk * but this doesn't work

Smilie

Last edited by jim mcnamara; 08-09-2013 at 11:21 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing first line from output

my script gives 10 outputs continuously..In each output i have to remove the first line in the output.How to do that. for eg : below is my output 0.00 1.00 5.00 0.00 7.00 i have to remove the first line of this output ie;0.00 (3 Replies)
Discussion started by: Krrishv
3 Replies

2. Shell Programming and Scripting

Removing Garbage output

I am using following code to read myfile.ddl line by line. But the thing is it is printing lot of garbage which are the names of the files and directories in which myfile.ddl is present. Kindly refine the code so that only myfile.ddl contents are only read LOGFILE="logfile.txt"... (4 Replies)
Discussion started by: skyineyes
4 Replies

3. Shell Programming and Scripting

Removing Null data in output

Hello all, I have a script that has an infile with system package information. For the most part the script is looking well. The only thing i need help is in testing for null entries and removing null data. #!/usr/bin/ksh for i in `cat /mwncps/bin/eco_pack` do NAME=`pkginfo -l |... (2 Replies)
Discussion started by: liketheshell
2 Replies

4. Shell Programming and Scripting

help removing characters for output file in shell script

hi i'm new to shell scripts and have a small problem i am running a batch converter that returns all flash .flv files in a directory and create a png image from each one the problem i have is the $1 variable , its ok on the first call but on the secound call $1.png , i have extra... (1 Reply)
Discussion started by: wingchun22
1 Replies

5. Shell Programming and Scripting

Removing spaces from the output of a head command

Im running the below commands in a script. Total_confirms=`cat $OUTPATH/count_po* | head -4 | tail -1` # echo "Total Confirms records we need: $Total_confirms" >> $LOG2 The problem is its always returning 4 spaces before the result.. Can I pipe the result into something else to remove the... (5 Replies)
Discussion started by: Jazmania
5 Replies

6. Shell Programming and Scripting

Removing Characters From finger Output

Hi Does anyone know of a command that will extract only the Login name alison and year 2005 from the following output. jamesm> finger alison Login name: alison In real life: Alison Smith - Queensland Directory: /data/home/alison Shell: /usr/bin/ksh... (2 Replies)
Discussion started by: jamba1
2 Replies

7. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

8. UNIX for Dummies Questions & Answers

Removing unnecessary eol ($) character from Oracle sql query output

Hi All, I am fetching oracle query result in shell variable. As columns numbers are more the output wraps in unix terminal .i.e one complete record in db gets store in multiple lines. with each line ends with $ character. I want to remove these unnecessary $ character but to keep required $... (8 Replies)
Discussion started by: Harshal22
8 Replies

9. Shell Programming and Scripting

Help in removing control M and Line feed in output file.

Hi All, In my output file i am getting control m character and also the line feeds at different places and with different combinations, the content of the file is supposed to be in a single line but if there is a line feed in between then from there onwards it's going into new line. I tried... (7 Replies)
Discussion started by: Bipin Kumar
7 Replies

10. Shell Programming and Scripting

Removing characters and some output

Hi guys, So I am using an awk command to return a specific column in a file. I also need to remove some extra characters. What I have is :: (http-/0.0.0.0:8091-9)|23:00:41 And what I want is : http-/0.0.0.0:8091-9 I tried using the td command but it is only removing the ( ,... (5 Replies)
Discussion started by: Junaid Subhani
5 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 01:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy