need to remove a range of files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need to remove a range of files
# 1  
Old 04-02-2009
need to remove a range of files

How come I remove the range of file from update.0001* to update.0002* and not other files.
# 2  
Old 04-02-2009
Code:
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 -
Code:
for file in update.0001* update.0002*
do
    echo "This file is gone: $file"
done

# 3  
Old 04-02-2009
Hi,

Thank you, that worked out...
# 4  
Old 04-03-2009
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...
# 5  
Old 04-03-2009
hi,

Any help on my request, please....
# 6  
Old 04-04-2009
Quote:
Originally Posted by gsiva
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...
Try this:

Code:
sed  '/script language/,/scripts>/d'  filename

# 7  
Old 04-04-2009
Quote:
Originally Posted by jim mcnamara
Code:
for file in update.0001* update.0002*
do
    rm -f $file
done

would this be easier?
Code:
rm -f update.0001* update.0002*

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed or awk to remove specific column to one range

I need to remove specific column to one range source file 3 1 000123456 2 2 000123569 3 3 000123564 12 000123156 15 000125648 128 000125648 Output required 3 000123456 2 000123569 3 000123564 12 000123156 15 000125648 128 000125648 (6 Replies)
Discussion started by: ranjancom2000
6 Replies

2. Shell Programming and Scripting

Check/print missing number in a consecutive range and remove duplicate numbers

Hi, In an ideal scenario, I will have a listing of db transaction log that gets copied to a DR site and if I have them all, they will be numbered consecutively like below. 1_79811_01234567.arc 1_79812_01234567.arc 1_79813_01234567.arc 1_79814_01234567.arc 1_79815_01234567.arc... (3 Replies)
Discussion started by: newbie_01
3 Replies

3. Shell Programming and Scripting

awk to remove range of fields

I am trying to cut a range of fields in awk. The below seems to work for removing field 50, but what is the correct syntax for removing a range ($50-$62). Thank you :). awk awk 'BEGIN{FS=OFS="\t"}{$50=""; gsub(/\t\t/,"\t")}1' test.vcf.hg19_multianno.txt > output.csv Maybe: awk... (6 Replies)
Discussion started by: cmccabe
6 Replies

4. UNIX for Advanced & Expert Users

Vi remove line range containing a string

In vi I would like to remove a line containing a string. I thought after reading this I could do this. https://www.unix.com/302297288-post3.html :'3560,3572/gcc/d' It keeps complaining vi mark not set. And sometimes it complains E488: Trailing characters. I don't understand what mark... (5 Replies)
Discussion started by: cokedude
5 Replies

5. Shell Programming and Scripting

Remove duplicate entries based on the range

I have file like this: chr start end chr15 99874874 99875874 chr15 99875173 99876173 aa1 chr15 99874923 99875923 chr15 99875173 99876173 aa1 chr15 99874962 99875962 chr15 99875173 99876173 aa1 chr1 ... (7 Replies)
Discussion started by: raj_k
7 Replies

6. Shell Programming and Scripting

Remove a range of lines from a file using sed

Hi I am having some issue editing a file in sed. What I want to do is, in a loop pass a variable to a sed command. Sed should then search a file for a line that matches that variable, then remove all lines below until it reaches a line starting with a constant. I have managed to write a... (14 Replies)
Discussion started by: Andy82
14 Replies

7. Shell Programming and Scripting

remove unwanted specific line range

Hello everyone...I have large txt file and I would like to remove unwanted specific line. My data is like this: So I would like to remove from line below No. until line reassambled like this: Thanks... (4 Replies)
Discussion started by: taxi
4 Replies

8. Shell Programming and Scripting

Remove strings within range using sed

Hey folks I have a big file that contains junk data between the tags <point> and </point> and I need to delete it (including `<point>' and `</point>'). i.e. a = 1 <point> 123123 2342352 234231 234256 </point> print a needs to become a = 1 print a I'm certain that this is a... (10 Replies)
Discussion started by: ksk
10 Replies

9. Shell Programming and Scripting

remove range part of a file with sed

Hello, I would like to remove a range from a file with sed or any script command that is appropriate The section start by and finish by and I would like to keep line Could you tell me which command I should type ? Thanks a lot, Franck My input file is like this... (1 Reply)
Discussion started by: mfranck
1 Replies

10. UNIX for Dummies Questions & Answers

cp only files in certain date range

hi all, I'm trying to do a cp only on files I created on a given day or within a certain date range. What's the best way to do this? Cheers, KL (1 Reply)
Discussion started by: ee7klt
1 Replies
Login or Register to Ask a Question