geom part list | egrep 'Name|freebsd-ufs' | xargs echo -n; echo
That's because you're probably trying to redirect by putting abut I couldn't redirect the output to a file.
>
at the end of the line.;
, which is just echo
.( … )
subshell and redirect its output: ( geom part list | egrep 'Name|freebsd-ufs' | xargs echo -n; echo) > file
../lsblk | grep "freebsd-ufs"
I was hoping that each match would appear on a line by itself... Tried putting in a '\n' but that didn't work...
\n
won't work, you need a literal newline. In this particular case you can insert newlines in front of each i. Name
(i = 1, 2, ...):
geom part list | egrep 'Name|freebsd-ufs' | xargs echo -n | sed 's/\([0-9]*\.\)/\
\1/g'
geom part list | egrep 'Name|freebsd-ufs' | xargs -J {} echo {} | sed "s/\./\n/g" | grep "freebsd-ufs" | awk '{print $2,$4}'
SirDice has already given you the answer:All I wanted was a simple list of all the freebsd-ufs partitions on all the disks attached locally, one per line.
This thread has got to be the most inefficient way of solving such a simple scripting task. You have kept five people guessing what it is you actually want over the course of half a day. I'm angry at myself for getting interested in the first place.gpart show -p | grep 'freebsd-ufs' | tr -s ' ' | cut -d ' ' -f 4
?
Everyone is free to email their invoices to /dev/nulSirDice has already given you the answer:
This thread has got to be the most inefficient way of solving such a simple scripting task. You have kept five people guessing what it is you actually want over the course of half a day. I'm angry at myself for getting interested in the first place.
I think that is the best solution.A variation:gpart show -p | awk '/freebsd-ufs/{print $3;}'