How come I remove the range of file from update.0001* to update.0002* and not other files.
for file in update.0001* update.0002*
do
rm -f $file
done
Warning - TEST this first to make sure you are getting the file you want -
for file in update.0001* update.0002*
do
echo "This file is gone: $file"
done
Hi,
Thank you, that worked out...
i need to remove the line in a file, such as
<script language=javascript><!-- . . . .. . . . . .. .. . . .. .
</scripts>
I need to remove the link with the header starts with <script language ....</scripts> Also, this line has to be removed for the files with the extension of *.html ... Could you please help me on this...
hi,
Any help on my request, please....
Try this:
sed '/script language/,/scripts>/d' filename
would this be easier?
rm -f update.0001* update.0002*
U can try this command: probably some modifications are required
rm -rf update.000?[1-2]*
that should also do it, although you can leave out the "-" since its only 1, 2
rm -f update.000[12]*
This cmd does the remove the line <script language> from the file.... Also, I have one doubt, the command has been closed with ">" after the script, but its not opened... I also tried with opening before the script start, but no luck...
sed '/script language/,/scripts>/d' filename
Re: ghostdog74 and jim mcnamara posts. There is a danger that expanding "*" will create an expanded "for" command which is too long for the shell.
A construct for unknown numbers of files and allowing for space characters or awkward characters in filenames. The "if -f" can prevent accidents with filenames containing awkward characters.
ls -1 update.0001* update.0002* 2>dev/null | while read file
do
# Only remove the echo if you are happy with what will be deleted
if [ -f "${file}" ]
then
echo rm -f "${file}"
fi
done
then pass to xargs