Sponsored Content
Top Forums Shell Programming and Scripting remove files with 0 size, space and double qoute Post 14854 by kanang on Thursday 7th of February 2002 07:09:42 AM
Old 02-07-2002
i would apply different logic than yours:
Code:
#!/usr/bin/ksh
for i in `ls -a`
do
  FILESIZE=`ls -l $i|awk '{print $5}'`
  if [ $FILESIZE -eq 0 ]
  then
    /usr/bin/rm $i
  fi
done

this way rm will surely remove no matter how a file is named.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash script working for small size files but not for big size files.

Hi, I have one file stat. Stat file contents are as follows: for example. H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000 Now i... (1 Reply)
Discussion started by: davidpreml
1 Replies

2. What is on Your Mind?

Hacker=Knowlegde Qoute

I don't know if anyone has seen this commercial, either on TV or on the internet, but it's an IBM Linux Prodigy commercial. Linux Prodigy 4Gf6hq8J_DQ At around 33 seconds there is a quote about collecting and sharing data. A couple of friends and I watched this and decided to try to create a... (0 Replies)
Discussion started by: Texasone
0 Replies

3. Shell Programming and Scripting

Check file size and remove files

Hi, Here we have a situation where we have to check the file size and if the file size is greater than 0 bytes then remove the files from the directory. 1)EdwTrxn 2)EdwPost 3)EdwTndr 4)EdwSls 5)EdwSlsRej 6)EdwTndrRej Files will be created in the directory in the following manner. ... (5 Replies)
Discussion started by: srivsn
5 Replies

4. Shell Programming and Scripting

To remove files with 0 File Size

Dear All, I want to remove files having size of (0) that are generated once script is completed. Here is the code but i m not sure about /usr/bin do i need to write /usr/bin, or the path of my script /tmp/test please find below the script logic #!/usr/bin/ksh for i... (9 Replies)
Discussion started by: jojo123
9 Replies

5. Shell Programming and Scripting

To remove the files in MB size

Hi, Using the shell script, I need to remove the files that are larger than 50 MB in size. I am not good in shell scripting. (1 Reply)
Discussion started by: gsiva
1 Replies

6. Shell Programming and Scripting

want to remove comma present inside double qoute

Hi friends... I have a dat file like below:- test_file.dat abc,ttt,"""123,89.98",yyu,opp vvv,"23,76.68",w564,"54,98.87",985 i need the remove the comma present inside the double qoute as output:- out_test_file.dat abc,ttt,"""12389.98",yyu,opp vvv,"2376.68",w564,"5498.87",985... (6 Replies)
Discussion started by: gani_85
6 Replies

7. UNIX for Dummies Questions & Answers

Remove two delimiters, space and double quotes

I would like to know how to replace a space delimiter with a ^_ (\037) delimiter and a double quote delimiter while maintaining the spaces inside the double quotes. The double quote delimiter is only used on text fields. I'd prefer a one-liner, but could handle a function or script that accepts... (4 Replies)
Discussion started by: SteveDWin
4 Replies

8. UNIX for Advanced & Expert Users

Need to remove leading space from awk statement space from calculation

I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation? Here is my query: cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}' 02:00:00... (1 Reply)
Discussion started by: bizomb
1 Replies

9. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

10. Linux

Ssh login with random qoute banner

I'll be honest here The one and only time I have done LDAP user and login configuration was for my RHCSA exam, and that was many years ago I have this interview coming up (for a linux admin position role), and while the other questions I have no problem answering I am stuck with this (image... (5 Replies)
Discussion started by: hedkandi
5 Replies
suspend(1)                                                         User Commands                                                        suspend(1)

NAME
suspend - shell built-in function to halt the current shell SYNOPSIS
sh suspend csh suspend ksh suspend DESCRIPTION
sh Stops the execution of the current shell (but not if it is the login shell). csh Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su. ksh Stops the execution of the current shell (but not if it is the login shell). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5) SunOS 5.10 15 Apr 1994 suspend(1)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy