View previous topic :: View next topic |
Author |
Message |
3PO Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/9424454044640eb15027ff.jpg)
Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sat Jul 20, 2013 10:11 am Post subject: [bash] Bedingtes Löschen? |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
l3u Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/535570295dff893c1fda6.png)
Joined: 26 Jan 2005 Posts: 2616 Location: Konradsreuth (Germany)
|
Posted: Sat Jul 20, 2013 3:30 pm Post subject: |
|
|
Code: | for i in $(seq 1 149); do rm "$i.foo"; done |
Edit: Geht sogar noch einfacher:
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
3PO Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/9424454044640eb15027ff.jpg)
Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Mon Jul 22, 2013 9:32 am Post subject: |
|
|
DANKE! ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|