Sponsored Content
Top Forums Shell Programming and Scripting remove files with 0 size, space and double qoute Post 14852 by nongrad on Thursday 7th of February 2002 07:03:20 AM
Old 02-07-2002
remove files with 0 size, space and double qoute

os=hpux11
shell=ksh

some jokers had written thousands of empty files into my $HOME. and the files are named inconsistently that some of them include space and double qoutes. all those files are of 0 size (when i did ls -al it told me so). the naming paterns are
like e.g of ls -al output:
Quote:
-rwxr-xr-x 1 unify dba 0 Feb 4 16:48 .file
-rwxr-xr-x 1 unify dba 0 Feb 4 16:48 .file name
-rwxr-xr-x 1 unify dba 0 Feb 4 16:48 .file "name"
being new to shell scripting i wrote this script:
Code:
#!/usr/bin/ksh
for i in `ls -al | awk '$5 < 1 {print $9}'`
do
  /usr/bin/rm $i
done

thank god that my attempt worked, but removed only the files whose name without space or double qoute. while the rest i am still cracking my little brain finding a way to deal with them.

any idea, pls.
 

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
GZEXE(1)						      General Commands Manual							  GZEXE(1)

NAME
gzexe - compress executable files in place SYNOPSIS
gzexe name ... DESCRIPTION
The gzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a penalty in performance). For example if you execute ``gzexe /usr/bin/gdb'' it will create the following two files: -rwxr-xr-x 1 root root 1026675 Jun 7 13:53 /usr/bin/gdb -rwxr-xr-x 1 root root 2304524 May 30 13:02 /usr/bin/gdb~ /usr/bin/gdb~ is the original file and /usr/bin/gdb is the self-uncompressing executable file. You can remove /usr/bin/gdb~ once you are sure that /usr/bin/gdb works properly. This utility is most useful on systems with very small disks. OPTIONS
-d Decompress the given executables instead of compressing them. SEE ALSO
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1) CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the PATH environment variable to find gzip and some standard utilities (basename, chmod, ln, mkdir, mktemp, rm, sleep, and tail). BUGS
gzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases, using chmod or chown. GZEXE(1)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy