Bash function not working…

Paul Smith paul at mad-scientist.net
Tue Jan 8 16:33:12 UTC 2013


On Tue, 2013-01-08 at 09:15 -0700, JD wrote:
> > speltid () {
> > ffmpeg -i $1 2>&1 | \
> > grep Duration | \
> > awk -F , '{print $1}' | \
> > sed 's/^.*Duration/Speltid/' | \
> > sed 's/\./,/'
> > }
> >
> Johnny,
> if you want the coma to be your field seperator, then you need
> to quote it, like this
> 
> awk -F "," '{ print $1 }'

Uh... no.

Comma is NOT a special character to the shell.  There's absolutely no
need to quote it.  The command lines

	awk -F , '{ print $1 }'
	awk -F "," '{ print $1 }'

are identical in every way... awk cannot tell the difference because the
SHELL will strip the quotes before it ever invoks awk.

Something else you did must have been different between the two attempts
you made (first rule of debugging: change only one thing at a time or
you can't know which change "fixed" your problem).

Cheers!





More information about the ubuntu-users mailing list