0032459999 0032458888 0032457777 0032451111 0032452222 0032453333 " I want to get a unique list of number that starts with "0032".
How can it be achived using grep command. (also we may require sed, sort and uniq along with grep)
Just a note, the file will be a large in size with lot of repetation. But just i need a unique list of numbers that starts with the pattern "0032".
I am planning to use fopen, reading the file line by line and then adding it to a array list... But I guess, it can be done more effeciently using grep.
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
i have missed some information in my previous communication.
The number starts with the pattern "0032" and it is 10 character length. And I will
get multiple numbers on the same lines. Some blank spaces, blank lines will also come in between the data.
I am getting the following output
code
0032459999 0032458888 0032457777 0032451111 0032452222 0032453333 0032451111 0032458888 00324522220032451111 003245222200324511110032451111 0032452222 0032453333
code
sort and uniq commands are not working.
What should be done to get a uniq value from this.
I have some files named file1, file2, fille3......etc. These files are in a folder f1. The content of files are shown below. I would like to count the unique pairs of third column in each file. some files have no data. It should be printed as zero. Your help would be appreciated.
file1
ARG... (1 Reply)
Hi,
I have a matrix like this:
Algorithm predicted_gene start_point end_point
A x 65 85
B x 70 80
C x 75 85
D x 10 20
B y 125 130
C y 120 140
D y 200 210
Here there are four tab-separated columns. The first column is the used algorithm for prediction, and there are 4 of them A-D.... (8 Replies)
Hi, I have a small piece of awk code (see below) that generates random numbers.
gawk -F"," 'BEGIN { srand(); for (i = 1; i <= 30; i++) printf("%s AM329_%04d\n",$0,int(36 * rand())+1) }' OFS=, AM329_hole_names.csv
The code works fine and generates alphanumeric numbers like AM329_0001,... (2 Replies)
Hello,
I have a file with a 1000 ids in the form of strings. I want to replace each id with a unique numbers in the whole file. each id is repeating in all the columns. I know I can use sed command but there are many ids in file which are need to be converted
example of input file
B752... (4 Replies)
Hello. I have 9060 files labelled File1 to File9060. They are in numerical order. When I grep a file eg. File90 it will show me all files that contain the pattern "File90", eg File901 or File9001. I can only get specific files for File1000 or higher. How can I resolve this problem? Is there a... (5 Replies)
Hello, I have a file with a list of car makes and specific information for each make. An example is:
@Audi:Warranty
@Audi:Pricing
@Audi:Colors
@Acura:Warranty
@Acura:Pricing
@Acura:Colors
and so on through a bunch of makes. I need to make a list in a selection box of just one name of... (4 Replies)
If i want to grep for a value in a file but display only unique value then which option can i use.
ex: Values in the file
IP <1.2.3.4> value <2>
IP <1.2.3.4> value <2>
IP <1.2.3.4> value <3>
IP <1.2.3.5> value <1>
i should get only the unique value (3 Replies)
Friends,
I have to write a shell script,the description is----
i Have to check the uniqueness of the numbers in a file.
A file is containing 200thousand tickets and a ticket have 15 numbers in asecending order.And there is a strip that is having 6 tickets that means 90 numbers.I... (7 Replies)