LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Syntax Error while using CMP function (https://www.linuxquestions.org/questions/linux-newbie-8/syntax-error-while-using-cmp-function-4175422253/)

dsfreddie 08-15-2012 03:11 PM

Syntax Error while using CMP function
 
Hi All,

I am getting a syntax error message while trying to compare 2 files using the compare function (LINUX)


Quote:

cmp -s <(tr , \\n < $COMMON_TMP/nt_per_gs.done | sort) <(tr , \\n < $COMMON_TMP/nt_per_chg_indx.done | sort)
Syntax Error Message

Quote:

command substitution: line 79: syntax error near unexpected token `('
command substitution: line 79: `cmp -s <(tr , \n < $COMMON_TMP/nt_per_gs.done | sort) <(tr , \n < $COMMON_TMP/nt_per_chg_indx.done | sort)'
+ file_cmp_chk=1
The return value should be 0 as both the .done file contain the same dates. (like below)


Quote:

$ cat /iis_dev_data3/wcc/cpmg/tmp/wcc_cpmg_nt_per_chg_indx.done
20120708,20120707

$cat /iis_dev_data3/wcc/cpmg/tmp/wcc_cpmg_nt_per_gs.done
20120708,20120707
Can you pls help to fix this issue

Thanks
Freddie

werewolfy 08-15-2012 03:37 PM

Didn't try it, just a quick shot:

Try putting a $ directly in front of both opening braces to make them an executable subcommand.

And are there really no spaces after the input redirection characters "<"?

Try additionally putting one there each (i.e. in front of the newly added "$" ), if the above does not help - the shell can be picky about whitespace.
Funny enough, you put spaces around the commas inside the brackets, which should be unncessary - but better too many than too few, if in doubt ;o)


All times are GMT -5. The time now is 03:34 PM.