Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grep?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Scandinavian
View previous topic :: View next topic  
Author Message
Spiralis
n00b
n00b


Joined: 22 Jun 2003
Posts: 47

PostPosted: Wed Aug 13, 2003 7:34 pm    Post subject: grep? Reply with quote

Hei,

Jeg er n00b som dere sikkert vet, og jeg har ett spørsmål.

Hvis jeg har en fil som inneholder en liste over mange filer.
Den ser f.eks slik ut:

hjelp1.txt
hjelp2.txt
hjelp3.doc
hjelp4.exe
hjelp5.log

Det jeg ønsker å gjøre er å ta bort "file extension" fra lista slik at den ser slik ut:

hjelp1
hjelp2
hjelp3
hjelp4
hjelp5

Hvordan kan jeg gjøre noe slikt?
_________________
Kristian
Back to top
View user's profile Send private message
Yarrick
Bodhisattva
Bodhisattva


Joined: 05 Jun 2002
Posts: 304
Location: Malmö, Sweden

PostPosted: Wed Aug 13, 2003 8:11 pm    Post subject: Reply with quote

Code:
ls |cut -d"." -f1


du tar ls och matar in i cut som har avgränsare (delimiter, -d) ".", och du vill ha det första fältet (field, -f).
Back to top
View user's profile Send private message
Spiralis
n00b
n00b


Joined: 22 Jun 2003
Posts: 47

PostPosted: Wed Aug 13, 2003 8:18 pm    Post subject: Reply with quote

Yarrick wrote:
Code:
ls |cut -d"." -f1


du tar ls och matar in i cut som har avgränsare (delimiter, -d) ".", och du vill ha det första fältet (field, -f).


Jeg skrev dette og fikk korrekt resultat:

Code:
cat files.txt |cut -d"." -f1 > files1.txt


Takk for tipset! :D
_________________
Kristian
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Scandinavian 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