mardi 5 juin 2018

Use and awk output pattern as input in sed

I have two files (file.1.test and file.1) $ cat file.1.test foo bar baz pattern

$ cat file.1

foo bar baz pattern this should NOT be printed next this sequence should be printed next this sequence should be printed Saying that: -my command 1 prints out the unique pattern in a file.1.test : $ cat file.1.test | awk '{print $1}' | tail -n1 pattern -My command 2 prints will print the sequences after the matching pattern in a file.1 $ cat file.1 | sed -e '1,/pattern/ d' | sed -ne '/^>/,$ p' next this sequence should be printed next this sequence should be printed Is there a way to perform these two tasks in only one command line ? Or is there any way to sed, or grep pattern that was the output of a previous command ?

Thanks in advance

Regards

Aucun commentaire:

Enregistrer un commentaire