I have a number in a text file like :
int_width: 5230
I want to set this number (5230) to a variable in csh.
What is the correct form? (grep is working before setting)
set WIDTH = "$(grep int_width *.txt | sed 's/[^0-9]*//g')"
I have a number in a text file like :
int_width: 5230
I want to set this number (5230) to a variable in csh.
What is the correct form? (grep is working before setting)
set WIDTH = "$(grep int_width *.txt | sed 's/[^0-9]*//g')"
set variable in csh you need to use set (more info)csh or tcsh all do not support $() and require ` ` for command substitution. Combine the above two and you'll get:
% set WIDTH=`grep int_width *.txt | sed "s,[^0-9]*,," `
% echo $WIDTH
5230