I have a number in a text file like :
int_width: 5230I 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')" 1 1 Answer
- In order to
setvariable incshyou need to useset(more info) - As mentioned by @muru comment - The original Bourne shell,
cshortcshall 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