hey all,
I have this code :
Code:
#!/bin/tcsh -f
set line=($<)
while($#line > 0)
echo $line[1]
set line=($<)
end
the usage to run the script would be :
Code:
./file < file2
Is there a way to specify filename in the script itself instead of getting/reading file name from STDIN ?
Using :
Code:
set file=data
instead of :
Code:
set line=($&
I write the line below in order to verify if first or second fields of list of numbers are equal to 146
I want to run the line from tcsh shell with one line as bash shell
please advice what the problem here in the syntax ?
echo $numbers
146 146 0 16 16 10 42 12 10 32 32 3 2 32 26
tcsh
bash -c 'for i in 1 2; do if [ 146 = `echo $numbers | cut -f$i -d' ' ` ]; then echo "NUM is OK "; fi done'
Hi All,
I'm writing a script to read a file line by line and then perform awk function on it. I am getting an error . My file has one name in it "James".
hi
i have a requirement to input a string to a shell script and to split the string to multiple fields,
the string is copied from a row of three columns (name,age,address) in an excel sheet.
the three columns (from excel) are seperated with a tab when pasted in the command prompt, but when the
string is assigned to a variable, the tab disappears to a space.
code is given below
Code:
echo
Hi All,
I am getting the following error when trying to run my script:
Code:
awk: 0602-565 There are not enough parameters in printf statement "BARCLAYS BANK 14%VRN PERP",.
The input line number is 84.
when I run from bash shell the command:
bash
for i in 1 2 3 ; do echo $i ; done
1
2
3
but when I switch to tcsh and want to run:
tcsh
bash -c for i in 1 2 3 ; do echo $i ; done
i: -c: line 1: syntax error near unexpected token `newline'
i: -c: line 1: `for'
i: Undefined variable.
please advice why I get errors ( I run the for loop from bash -c its the same ?
and what I ne
dear all,
I tried to compile this shell script it give me error
Code:
n=1
# continue until $n equals 5
while [ $n -le 5 ]
do
echo "Welcome $n times."
n=$(( n+1 ))
done
This is the error on the terminal
Code:
./while.sh: line 4: while[1 -le 5]: command not found
Hi,
I'm trying to read a line and the next line in a shell script by executing the following code:
Code:
for i in `seq 1 $numLines`; do
line=$(sed -n '{$i}p' outputFile)
echo $line
done
$numLines contanis the outputFile's number of lines.
It doesn't work and I cannot use a while loop because I need to reed $(i+1) line after $i line.
Hi guys, I have a script that checks disk usage and emails if it is low but it keeps returning this error:
Use of uninitialized value in concatenation (.) or string at ./df.pl line 17.
tail: cannot open `+2' for reading: No such file or directory
Use of uninitialized value in addition (+) at ./df.pl line 20.