I am relatively new to UNIX and am having some really weird results with redirecting output. I will start at the beginning.
I have a file with consists of a list of a chemical name followed by a tab and then a string of characters known as a SMILE string in this format
the list is 22 lines long.
I am using csplit to split the file (the file is called 22hits) into multple individual files using this command:
BTW, I am confused about why I have to use the number 20 instead of 22 if I want 22 separate files. Regardless, that is something I figured out by trial and error. This is not the major problem, however.
The resulting files have the name seq00, seq01, seq 02 etc. and contain and individual line of data including the name of the chemical and the SMILE string.
Now, to rename the files to the chemical names, I am using the following shell script:
This script changes the tab between the name of the chemical and the SMILE string to a newline, retrieves the name alone and then renames the file with that name.
Additionally, I am trying to remove the name of the compound in the file so that I have a file named PS_1 for example, and the only information it contains is the SMILE string, not the name of the compound, followed by a tab, followed by the SMILE string.
To accomplish this, I am using the following script:
Again, I am replacing the tabs with newlines, returning the line that does not have 'PS_', which should be the smile string, and then directing that output to the file. The problem is....for some files, i get the desired results, and for others, the file comes back with all data removed. The bigger problem is, I can repeatedly run this series of scripts on the same file (22hits) and get different results every time. Sometimes, half have the desired result, and the other half have the data deleted. Other times, only a few have the data deleted and the others have the desired result.
This is really confusing!!! Can anyone help??
Last edited by pludi; 01-22-2010 at 02:30 AM..
Reason: code tags, please...
Wow thanks for the fast response. Yes you understood the overall problem correctly, and your solutions seem much simpler even though I don't completely understand all of the commands. I tested the script and it does exactly what you said it would on the test file containing PS_1, PS_2, etc. Unfortunately, the SMILE strings are a little more complicated and include a few characters that seem problematic. This is an example:
I'll try to modify the script so that these characters (I think its the parentheses) are not problematic. Hopefully I can figure this out. Do you know an easy solution?
i very newbie unix
i already download FreeBSD-10.0-RELEASE-i386-disc1
but i don't know how to use it
can anyone tell me, i use win 7 and i like to learn, i read a book teach your self unix in 24 hour but not told me how i do the first time
do i need to made dual boot ? in windows system
what... (4 Replies)
Hi all,
1. How are we going to call .cmd files which is in window under Unix Environment?
2. Is there any equivalent command in Unix for "start" which is available in Windosw?
Thx very much. (5 Replies)
Hi everyone! Thanks for taking the time.
I've installed redhat and ubunto on vmware virtually.
I want to try unix and I tried to look in the internet but wasn't able to accomplish my desire task.
Any links for install, download links and information will be honestly appreciated. I will be... (6 Replies)
I'm not all that much of a newbie but I've not encountered this before. Happens both in Cygwin and in Mac OS X (Darwin):
cp -R /path/to/foo/.* /path/to/bar
(where directory 'bar' exists)
... seems to copy not only the contents of directory 'foo', but also other directories that are... (3 Replies)
Hello everyone,
Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware.
I hope I am not missing anything! :p (4 Replies)
i have just installed UNIX 7.01 to replace a windows server2003 used for my family to share and remotely save photos
i need to set it up so very novice users can view, import and export photos most of the remote users will have windows machines,i use Linux, Mac and windows.
most of what i want... (2 Replies)
Hi
Im a newbie to unix having been a windows guy, yes I know a swear word on here ? but part of my new job is to be trained up on Unix.
On the course we were set a task to read a file that has dates times codes etc, a log file. see below as an example
2007/02/19 00:00:06: Information: Switch... (3 Replies)
hi
im new to unix i use windows on my home pc
the reason i registered is because im finishing up a UNIX class this year. all i have left is the exam but i had a lot of personal problems and didnt do a lot of work; the teacher is letting me make it up but its hard for me to learn a whole unix... (1 Reply)
Hey,
I've been a windows guy all my life, but i have finally decided to move to Unix and buy a Mac. I am pretty good with a lot of programming applications on windows, but was wondering if u guys had any advice on how to get started on Unix, like books to read, applications to buy, websites,... (8 Replies)