Help with wc and subtraction needed

Matthew Benjamin msbenjamin12 at gmail.com
Fri Jul 13 01:21:32 UTC 2007


Very sweet that work perfect, thanks!


On 7/12/07, Todd Zullinger <tmz at pobox.com> wrote:
>
> Matthew Benjamin wrote:
> > I have a command that I am trying to read a particular amount of
> > lines with
> >
> > wc -l somefile | awk '{print $1}'
> >
> > when it givs the number of lines, I am trying to find out how to use
> > that number in an addition problem. Can someone help me with that?
>
> lines=$(wc -l somefile | awk '{print $1}')
> res=$(($lines + 42))
>
> That's bash specific, so depending on how portable you want the script
> to be, you'd need to do things slightly differently.  There are a ton
> of ways you could do something like this.  Some bash guides might be
> helpful:
>
> BASH Programming - Introduction HOW-TO
> http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
>
> Advanced Bash-Scripting Guide
> http://tldp.org/LDP/abs/html/
>
> --
> Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> I advise you to go on living solely to enrage those who are paying
> your annuities. It is the only pleasure I have left.
>     -- Voltaire
>
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
>


-- 
mB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070712/bbca810d/attachment-0001.htm>


More information about the fedora-list mailing list