hmmm... I don't how to ask the question I guess. And I did not understand a lot of what is going on in your suggestion, vgersh99. I feel like I am making this more complicated than I need to. I found a work around, as inelegant as it is:
I have 10 lists. Each list contains all of the subject numbers, one number per line, grouped by experimental condition. Because I dont know how to make grep read patterns from file, I used vi to insert:
around the subject number on every line, saved it as $ec.grep and then ran the file as a shell script:
This solved the first problem.
Now, what I want to do now is very simple. I have a list of subject numbers (call it sn.all). I have a second list (call it sn.rm) of subject numbers that need to be deleted from the first list. I have about 500 subject numbers, and I have 60 something that need to be deleted. I want to somehow compare sn.all to sn.rm, and remove all numbers in sn.rm from sn.all and create a new file calls sn.fin.
I hope this makes sense. The fact that I don't know what I am doing makes this harder.
Thank you for your help, mods! I just wanted to let you know that you can close this thread if you like, because I came across a solution. I have never used sed before, but it has the option to read from file like I want to do, and I should be able to mimic the grep functionality with it.
Now I am going to bombard the boards with sed questions. Yippee!
I dont understand how this would work. It looks to me like list would be the file name of my list file, and name would just read in each record in the file (??? I dont know if that is the right interpretation). Then, the grep command looks for lines in the data file that start with the subject numbers in the list file. However, If I print to >> $name.out, then I am going to have a new file for every subject... which would not be good. I want to group by experimental condition.
If I am interpreting this correctly, I would be able to to this and just define the output files name to explicly be the ec number, if I read from my individual lists that are already grouped by condition.
Is there a way to read in column $1 from the list file (which is the ec) and have that govern the name of the .out, and then read the second column of the list file (the subject number) into the grep search pattern pattern?
So the grep line would be something like this, i think:
I just dont know how to read in the master list file so that it would work.
I don't want to be too specific in case you are just doing homework, but you had spaces in your example, and it sounded like you wanted files such as 1.out, 2.out.
I understand better now, thanks. Unfortunately, I am not doing homework. Just working in a lab where windows is a swear word and I am being motivated to learn shell scripts.
We have the data looks like below in a log file.
I want to generat files based on the string between two hash(#) symbol like below
Source:
#ext1#test1.tale2 drop
#ext1#test11.tale21 drop
#ext1#test123.tale21 drop
#ext2#test1.tale21 drop
#ext2#test12.tale21 drop
#ext3#test11.tale21 drop... (5 Replies)
Hi Team,
in /tmp folder i have thousands of log files i want to read each file and grep a value called "Calling This".
Each logfile name is different but it ends with .log.
How can i achieve this?
Please excuse if i did any mistake by not following forum standards. I will surely follow... (10 Replies)
I have input data looks like this which is a part of a csv file
7,1265,76548,"0102:04"
8,1266,76545,"0112:04"
I need to make the output data should look like this and the output data will be part of text file:
7|1265000 |7654899 |A|
8|12660000 |76545999 |B|
The logic behind the... (6 Replies)
I need to read a text file that contain columns of data, i need to read 1st column as a function to call, and others are the data i need to get into a ksh script.
I am quite new to ksh scripting, i am not very sure how to read each row line by line and the data in each columns of that line, set... (3 Replies)
In the hello.htm have the sentenses:
Hello $name
How are you?
The perl script:
$name = "David";
open(HEADER,"hello.htm");
while(<HEADER>) { $html .= $_; }
close(HEADER);
print "$html";I making something about template. But it can't process the $name variable. (4 Replies)
Hi Frnds...
I have an input file name.txt and another file named as source.. name.txt is having only one column and source is having around 25 columns...i need to read from name.txt line by line and search it in source file and then save the result in results file..
I have a rough idea about the... (15 Replies)
I have 3 columns in an excel sheet.
c1 c2 c3
EIP_ACCOUNT SMALL_TS_01 select A.* from acc;
All the above 3 col shoud be passed a variable in the unix code.
1.How to read an excel file
2.How to pass these data as variable to the unic script (1 Reply)
This is shell programming assignment.
It needs to create a file called .std_dbrc contains
STD_DBROOT=${HOME}/class/2031/Assgn3/STD_DB
(which includes all my simple database files)
and I am gonna use this .std_dbrc in my script file (read the data from the database files)
like this: .... (3 Replies)
Hi,
I have a data file formatted like this:
Ex:
Mike 3434
Jack 481
Peter 12
Alan 926
I want to get this data into 2 variables: "Names" and "Numbers" that I can using one "for" loop to get the value as Names and Numbers
Like this:
for i in 0 1 2 3
do
echo $Names
echo... (12 Replies)
I am a FORTRAN guy and not a UNIX expert by any means so sorry if this sounds dumb, but all I want to do is have a UNIX script which reads data from a file (say 1000 lines worth, each row is a file name) and store it in an array to perform an operation on later. As maddeningly simple as this... (2 Replies)