#!/bin/bash
while read line; do
echo "$line"done < $1
If you want to skip empty lines...
#!/bin/bash
while read line; do
if [ ! -z "$line" ]; thenecho "$line"
fi
done < $1
if you want to skip lines starting with '#'...
#!/bin/bash
if [[ ! "$line" == \#* ]]; then
echo "$line"
fi
done < $1
while read line; do
if [ ! -z "$line" ]; thenif [[ ! "$line" == \#* ]]; then
echo "$line"
fi
done < $1
if line has <field> <value> pair separated by ':' e.g. name:john, do this:
while read line; do
if [ ! -z "$line" ]; then
if [[ ! "$line" == \#* ]]; then
left=${line%:*}
echo "$left"
right=${line#*:}
echo "$right"
fi
fi
done < $1
where 'left' is <field> and 'right' is <value>
No comments:
Post a Comment