[SLUG] SED help

From: Keith Lelacheur (themercuryman@gmail.com)
Date: Thu Jul 21 2005 - 10:56:14 EDT


I am having one of those days, can anyone help out with a probably
very simple question? I have a script to move through each line of a
file and do some parsing with a combiantion of sed and awk. I am
having trouble passing a variable into the address portion of the sed
command though. The basic outline is :

____________________________
#!/bin/bash
filename=$1
filelines=`wc-l $filename`
for ((a=1; a <= filelines ; a++))
do
        sed '$aq;d' $filename
        blah,
        blah,
        blah,
done
_____________________________

the problem with the -- sed '$aq;d' $filename -- syntax is that it
process evey line of the file not the line number specified by the
loop counter. I have also tried -- sed -n '$ap' $filename -- but it
just returns the "p". Another attempt was -- sed '$a!d' $filename --
and it returned the whole file as well. Any help with passing the
variable to the SED address would be most appreciated.

Thanks,

Keith

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:09:29 EDT