24-02-2012, 11:58
|
מנהל פורומי "תכנות ובניית אתרים" ו"חומרה ורשתות"
|
|
חבר מתאריך: 25.10.01
הודעות: 42,775
|
|
בתגובה להודעה מספר 1 שנכתבה על ידי בזוקה שמתחילה ב "בחירת קטע טקסט (משורה שמתחילה ב-X ועד שורה שמתחילה ב-המילה Y)"
will that work for you...
קוד:
$ cat test
this is a some text file made for mr. bazooka!
this is a test string
some more lines are
added here just because
i am quite bored.
now, i want to copy
from the sentence that has the word 'test',
all the lines until i get to the sentence
that has the word 'end' in it.
do you think this is going to work? :)
$ sed -n '/test/,/end/p' test | head -n -1
this is a test string
some more lines are
added here just because
i am quite bored.
now, i want to copy
from the sentence that has the word 'test',
all the lines until i get to the sentence
(כמובן שבסוף הפקודה אתה יכול לעשות > שםקובץ.txt כדי לשמור את הפלט הזה לקובץ אחר במקום לפלוט אותו למסך)
(וכמובן שאפשר לשפר את ה regex כדי לחסוך את ה head... לא היה לי כוח )
|