addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Re: [opensource-62] sed help

From: Pablo P.
Sent on: Tuesday, February 18, 2014 12:16 AM
Hi mowgli,

Try this:

sed  '/^replacefromhereon$/,$d'  file.txt

'd' will delete all lines in this range: from the line matching 'replacefromhereon' and the end of the file ($). Note that the above will only output the changes to the terminal. To actually modify the file use the option '-i' (in place):

sed  -i  '/^replacefromhereon$/,$d'  file.txt

Hope it helps.

On 02/17/[masked]:46 PM, mowgli wrote:
using sed (or awk or whatever is best/shortest command), how do i replace ALL the text from a matchedpattern to EOF in a file?

ie if the file is:


and i want the file to be:


except i wont know what all the text after "replacefromhereon" is.  so i need to replace from that matched pattern to EOF regardless of whats there.

how do i achieve in simplest way?

Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by mowgli ([address removed]) from Dallas Open Source Saturday.
To learn more about mowgli, visit his/her member profile
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy