Above is just a miniature version of the file. In fact, considering the first column of the file that is 0 0 1 1 2, the numbers in actual go until 10442.
This means my actual file looks like this:
What I want to do is to look in the first column, extract all the lines which have 0 in the beginning and store in the file 1.num
Referring to the above example, this is what I mean:
The above numbers go in file, 1.num
Lines which begin with 1, go in file named 2.num
Subsequently,
goes in file 10443.num
The number of lines containing 0's or 1's or 10442's is not fixed. This means I have to look at the first number from each line and keep storing the lines with the same number in the same file.
I am not able to figure it out as to how to tackle this but I show as to what I have done:
The above code has following problems:
1. I am not able to put in the searching part that is the part which searches for 0 or 1 or 2 etc in the beginning of every line.
2. It gives syntax error message.
I am using Linux with BASH.
Last edited by shoaibjameel123; 07-18-2011 at 05:32 AM..
Reason: Added extra information
Dear UNIX experts,
I'm a command line novice working on a Macintosh computer (Bash shell) and have neither found advice that is pertinent to my problem on the internet nor in this forum.
I have hundreds of .csv files in a directory. Now I would like to copy the subset of files that contains... (8 Replies)
Hi experts,
I am using KSH and I am need to display file with number in front of file names and user can select it by entering the number.
I am trying to use following command to display list with numbers. but I do not know how to capture number and identify what file it is to be used for... (5 Replies)
I have two files for comparison which are extracts from set of xml files.
file1 has:
Comparing File: BRCSH1to320140224CC3.xml
:: TZZZ:BR
:: TAZZ:OUT
UIZZ:0 :: ERAZ:1.000000
UIZZ:0 :: CTZZ:B
UIZZ:0 :: CCAZ:MYR
Comparing File: BRMY20140224CC18REG013SPFNSY13.xml
:: TZZZ:BR
:: TAZZ:INB... (1 Reply)
Experts
I have a list of files in the directory
mysample1
mysample2
mysample3
mysample4
mysample5
mysample6
mysample7
mysample8
mysample9
mysample10
mysample11
mysample12
mysample13
mysample14
mysample15 (4 Replies)
Hello Friends,
Can anyone help me for the below requirement.
I am having a file called Input.txt.
My requirement is first check the count that is wc -l input.txt
If the result of the wc -l Input.txt is less than 10 then don't split the Input.txt file. Where as if Input.txt >= 10 the split... (12 Replies)
I've written the script below to merge only .txt files that exist in one directory into one huge .txt file and ignore other files with other extensions.
now the result is one huge .txt file with all the contents of other .txt files
how can i add a File Name as a comment before each file?
... (12 Replies)
Hi there,
I'm trying to merge two files and make a third file.
However, two of the columns need to match exactly in both files AND I want everything from both files in the output if the two columns match in that row.
First file looks like this:
chr1 10001980 T A
Second... (12 Replies)
I have hundreds of files numbered in consecutive number in one single folder
What I would like to do is to make as many subfolders as needed (dependeing on the number of individual files) and name them Folder01, Folder02, etc.
Then, move file01 to folder01, file02 to folder02 so on and so... (3 Replies)
I am getting a few gzip files into a folder by doing ftp to another server. Once I get them I move them to another location .But before that I need to make sure each gzip is not more than 5000 lines and split it up . The files I get are anywhere from 500 lines to 10000 lines in them and is in gzip... (4 Replies)