Using bash variables for range in sed -
sed -n '5,10 p' < /proc/cpuinfo
prints 5-10 lines of file /proc/cpuinfo
i want use
start=5 end=10 sed -n '$start,$end p' < /proc/cpuinfo
so can change values of start , end form script.
you need use double quotes variable expansion:
start=5 end=10; sed -n "$start,$end p" < /proc/cpuinfo
Comments
Post a Comment