10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how to remove empty files tried below command its remove only zero bytes not empty file which is greater then zero byte.
for x in *
do
if
then
rm $x
fi
done (8 Replies)
Discussion started by: Kalia
8 Replies
2. Shell Programming and Scripting
Hi gurus,
I have a script which works fine.
https://www.unix.com/shell-programming-and-scripting/239347-how-pass-string-into-sql-query.html
while read p
do
&& para="'${p}'" || para="${para},'${p}'"
done < filePlease use code tags as required by forum rules!
a few days... (6 Replies)
Discussion started by: ken6503
6 Replies
3. Shell Programming and Scripting
Dear community,
I have two output files that contains some CR
# cat first.out
1234567890 598679857648566 9
1234567234 365837465873465 4
2342343243 289374982374894 4
# cat second.out
2342342342 ... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
4. Shell Programming and Scripting
Hello:
Is there a simple way to remove empty records of FASTA format file?
A FASTA format consists of two parts: header and sequence (for non-biologist, Wiki for details of course!). The header always start with ">" for the name of the sequence. The header must be in this ONLY single line.... (9 Replies)
Discussion started by: yifangt
9 Replies
5. UNIX for Dummies Questions & Answers
Hi all !
I'm sure it is a basic question but I didn't find any threads that fit my need.
How to remove empty fields with awk?
Or in other words, how to shift all the fields after an empty field on the left?
input:
1|2||3|4|5||6
wanted:
1|2|3|4|5|6
I tried:
awk '{for(i=1; i<=NF;... (7 Replies)
Discussion started by: lucasvs
7 Replies
6. Shell Programming and Scripting
Hi all,
I'm trying to remove when this condition is met: an empty and the next one
I'm using this command:
sed '/^$/N; s/&//' file
Which searches for an empty line, N attaches it to the next line, and substituing the combination with nothing.... but it is not working.
What I'm missing... (1 Reply)
Discussion started by: meuser
1 Replies
7. Shell Programming and Scripting
Hello:
I searched here for "vi -c" but found no hits.
How can I use vi -c to remove ALL empty lines, regardless of how many?
I tried
<code>
vi -c ":g/^$/d | wq" filename
</code>
but I have to run it several times.
This is NOT homework. :)
Thanks for your time. (3 Replies)
Discussion started by: Habitual
3 Replies
8. UNIX for Dummies Questions & Answers
I know this one was answered before in forum below -
https://www.unix.com/unix-dummies-questions-answers/58210-removing-empty-folders-using-find-command.html
But that one is closed & I have a question so here it goes.
I want to delete all 2006 files. Now if along with the files, if the... (2 Replies)
Discussion started by: kedar.mehta
2 Replies
9. Shell Programming and Scripting
Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted.
I've be... (5 Replies)
Discussion started by: cat123
5 Replies
10. Solaris
Hi, Any command or means to delete a director which is not empty
rmdir or similar
iam using Sun Solaries 2.6 :confused:
I have many full directories with subdirectories and I can not go on emptying them all (5 Replies)
Discussion started by: adol3
5 Replies
rmdir(1) General Commands Manual rmdir(1)
NAME
rmdir - remove directories
SYNOPSIS
dir ...
DESCRIPTION
removes the directory entry for each dir operand that refers to an empty directory.
Directories are removed in the order specified. Consequently, if a directory and a subdirectory of that directory are both specified as
arguments, the subdirectory must be specified before the parent directory so that the parent directory will be empty when tries to remove
it. Removal of a directory requires write and search (execute) permission in its parent directory, but no permissions on the directory
itself; but if the sticky bit is set on the parent directory, only the owner of the directory, the owner of the parent directory, or a user
having appropriate privileges can remove the directory.
Options
recognizes the following options:
Force each directory to be removed without prompting for
confirmation, regardless of the presence of the option. This option also suppresses diagnostic messages regarding non-exis-
tent operands.
This option does not suppress any diagnostic messages other than those regarding non-existent operands. To suppress all
error message and interactive prompts, the option should be used while redirecting the standard error output to
This option ignores any previous occurrence of the option.
Write a prompt to the standard error output requesting confirmation
before removing each directory.
This option ignores any previous occurrence of the option.
Path removal.
If, after removing a directory with more than one pathname component, the parent directory of that directory is now empty,
removes the empty parent directory. This continues until encounters a non-empty parent directory, or until all components of
the original pathname have been removed.
When used in conjunction with the option, asks whether to remove each directory component of a path.
EXTERNAL INFLUENCES
Environment Variables
provides a default value for the internationalization variables that are unset or null. If is unset or null, the default value of "C" (see
lang(5)) is used. If any of the internationalization variables contains an invalid setting, will behave as if all internationalization
variables are set to "C". See environ(5).
If set to a non-empty string value, overrides the values of all the other internationalization variables.
determines the interpretation of dir names as single and/or multi-byte characters, the classification of characters as printable, and the
characters matched by character class expressions in regular expressions.
determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informa-
tive messages written to standard output.
determines the location of message catalogues for the processing of
International Code Set Support
Single- and multi-byte character code sets are supported.
DIAGNOSTICS
Generally self-explanatory. Note that the option does not suppress all diagnostic messages.
EXAMPLES
To remove directories with a prompt for verification:
directories
To remove as much as possible of a path, type:
SEE ALSO
rm(1), rmdir(2), stat(2).
STANDARDS CONFORMANCE
rmdir: SVID2, XPG2, XPG3, XPG4
rmdir(1)