Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[bash] Bedingtes Löschen?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sat Jul 20, 2013 10:11 am    Post subject: [bash] Bedingtes Löschen? Reply with quote

Hallo Zusammen,

ich stehe gerade mal wieder auf dem Schlauch..

Ich habe ein Verzeichnis mit Dateien, die so aussehen:

Code:
1.foo
2.foo
3.foo
.....
1599.foo


Nun möchte ich alle löschen, die "< 150.foo" sind.

Wie stelle ich das am besten an?
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2537
Location: Konradsreuth (Germany)

PostPosted: Sat Jul 20, 2013 3:30 pm    Post subject: Reply with quote

Code:
for i in $(seq 1 149); do rm "$i.foo"; done

Edit: Geht sogar noch einfacher:
Code:
rm {1..149}.foo
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Mon Jul 22, 2013 9:32 am    Post subject: Reply with quote

DANKE! :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum