bash - Keep the delimiter in the output of cut -


I have a script which, to remove some code from search, cut Uses Path. Something looks like this:

  PLACE = $ (grep foo flatfile.txt | cut -d '/' -f 1-6)   

Output this Looks like:

  machine1: / path / to / where / foo / is machine2: / another / path / to / find / foo   

I It should look like this:

  machine1: / path / to / where / foo / is / machine2: / another / path / to / find / foo /   

This console should be printed with the echo "$ PLACE" at the end of the script or some such output will always have at least 2 rows, but usually more.

I tried, which I thought I could think with Echo, but it does not show any output or gives output:

  grep : '/' Is a directory   

I am running bash 3.00 on Solaris, if he does any help, I would really like KIS. Despite the deduction of something else at the end of the command, and not with the seed or the unit being with the monkey But, if this is the only way, then be it.

Try this: PLACE = $ (grep foo flatfile .txt | cut -d '/' -f 1-6 | xargs -i "%" echo% /)

Comments

Popular posts from this blog

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -