amit_g's solution will include heading and ------
You can try the following if you only want numbers.
Main Topics
Browse All TopicsI have a file containing lines shown below.
I need a script that will extract out only the first
doc_id pages surface_id_1 surface_id_2
------ ----- ------------ ------------
11595450 2 3527 3212
11595454 7 3527 3212
......
78299798322 5 3527 3212
^===========
|Only Numbers in this column needed
|
space in first column to be removed
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks, just to ask 2 last question for this thread:
awk '{ print $1 }' file.txt | egrep -e '^[0-9]*$' > file1
Note that file1 contains all 8 digit lines. Next I
need to sort the lines from smallest number to
largest number at the bottom of file.
Next, I need to find out if each of the number in file1
is found in file2 but I ran into problem with following
command (think it's because file2 contains number
that can be from 5 to 9 digits) :
awk '{print $1}' file2 | comm -23 file1 - >file3
as file3 contents is exactly the same as file1.
I did sample check & found that all numbers in
file1 are found in file2. What I need is for file3
to contain only numbers/lines from file1 that are
NOT found in file2
Suppose I have file2
Hi Tintin
All the files already don't have header, my problem now is
(let me rephrase as earlier postings was written in a confusing manner) :
I need to find out if each of the number (or line) in file1
is found in file2 but I ran into problem with following
command (think it's because file2 contains number
that can be from 5 to 9 digits) :
awk '{print $1}' file2 | comm -23 file1 - >file3
file3 should contain only lines from file1 that are
not found in file2
Business Accounts
Answer for Membership
by: amit_gPosted on 2009-10-13 at 22:10:13ID: 25567409
sed 's/^ *//g' FileName | cut -d" " -f1