[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] hmmm, curious... (OFFTOPIC)



On Thu, Jan 31, 2002 at 09:11:13AM +0800, Colin Coe wrote:
> 
> Hi all, I have come accross a strange problem while doing some scripting
> with lvdisplay.  When I use lvdisplay piped to awk in the first example
> (noting that I have 'hard-wired' one field in awk), a second line is printed
> containing all hard-wired strings, including tabs.  But if I encase the
> lvdisplay in backticks and use echo then piped to awk the problem does not
> exist.
> 
command substitution (backticks if you whish) replaces all newlines with blanks
compresses sequences of blanks and trims trailing blanks
if you want only the first line in awk do:
lvdisplay -c /dev/rootvg/bbs | awk -F: 'NR==1 {print $1 "\t\t" $9 "\t" $9 "\t" "2" "\t" $4 }'

-- 
Luca Berra -- bluca comedia it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]