Hi,
I have been trying to do a little script in Csh, to classify some information of a text document.
My problem appears when i have to calssificate two parts of the same line into different variables, for example in the document appears something like that:
ID NAME
999999,Michel Luka
888888,Lara Croft
In my scrypt, im trying to take first the ID to save it into a variable and second the NAME to save it in another variable, the only thing that i know is that with the code:
i get printed the two parts, but dont know how to save each part in different variables to do:
echo $ID and $NAME
Thanks, and sorry for my english, today im a bit thick :/
For non csh
HINT: Either seperate the headings as well with a "," or change to done<login.dat|grep -v ID or foreach line ( "`cat login.dat|grep -v ID`" ) accordingly.
Hope this helps
Last edited by sea; 10-13-2013 at 03:12 PM..
Reason: Yeah, should test first in csh, rather than other way around
Dear all,
I have a file like this:
imput
scaffold_0 1
scaffold_0 10000
scaffold_0 20000
scaffold_0 25000
scaffold_1 1
scaffold_1 10000
scaffold_1 20000
scaffold_1 23283
and I want the output like this:
scaffold_0 1 scaffold_0 10000
scaffold_0 10000 scaffold_0 20000... (6 Replies)
Hi guys,
I was wondering if there was an easy solution, using tcsh, to print out lines that appear twice with a given pattern in a file?
So if I am looking for lines with "test" in a given file that contains:
blah
test blah1
blah //don't print this out as it doesn't have... (3 Replies)
Hi all,
I jut use a loop to read lines from the user and redirect it to a file.
echo "Enter the line"
while read -r LINE
do
echo $LINE >> FILE
if ;then
break
fi
done
input
app... (1 Reply)
I have a simple script that sets a value and reads the value in csh:
set -x
set a = 10
echo $a
The output of the script does not show the value of a
+ set a = 10
+ echo
any help would be great. (4 Replies)
I want a script that while it read the lines in the file below,it will check if the second variable is greater or equal 10.if less delete the line
tom|2
john|5
simms|23
reed|30
paul|11
After running scripts i should get
simms|23
reed|30
paul|11 (5 Replies)
Hi,
does somebody know how can I step on the lines in a file?
I would like to read a file line by line. And after every line I'd like to do other commands.
Lets help me! ;) (4 Replies)
hi i have a long sed command in a csh script that won't fit on 1 line.
how do i break it up correctly over multiple lines?
this doesn't seem to work in csh:
sed -e s/template/$IP.$NN/ \
-e s/NRG/6/ \
-e s/inputf/$IS.$NN/ \
-e s/SHIFT/10.0/ <template.egsinp > $IP.$NN.inp
i get:
sed:... (1 Reply)
Hi all,
I have a file whose content I need to read and get the 3rd line .. ex:
one
two
three
What I need is to read a content of third line of this file and print first three characters ... I could print first three characters with "head -c 3" if I could get the content of the third line... (4 Replies)
Hi All,
I need to read line by line from a file(created using vi editor) till end of the file and pass it to my own executables so that it will read first line and execute and then other and so on...Thanks
The steps are like this;
1) read first line in file
2) execute the job with first line as... (2 Replies)
I have a file that has a list of numbers in it. Each line has a different number. I am trying to create some sort of loop within a script that will pick the numbers up on lines 1 and 2 and then put those figures into the script. It then goes through the process then loops back and reads lines 2 and... (5 Replies)