Need to get First column from the text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to get First column from the text file
# 1  
Old 12-30-2008
Need to get First column from the text file

Hey Guys,

I have a very urgent requirement regaridng the searching for value on the text file.

The text file is in the below format

Number Description

"112323", mysampletest1

"12122412", mysampletest2

"11232143", mysampletest3


I need to get the first column like

112323
12122412
11232143

i did try with awk '{print $1}' xyz.txt

it prints the description also .

CAn you please suggest as to which command can make the above requiremet possoble.

Thanks in advance.
# 2  
Old 12-30-2008
try this,
Code:
awk -F , '{print $1}' abc.txt

- nilesh
# 3  
Old 12-30-2008
Try also

cut -d, -f1 abc.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

2. UNIX for Dummies Questions & Answers

Add a column of 0's to a text file

Hi, I have a text file with many column (1,000,000+). I want to add a column of 0's as the third column. I tried: awk '{$3=0}1' input file > output file But it simply replaces the third column with 0's instead of adding a new column. How do I go about doing this? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

3. Shell Programming and Scripting

Want to format column of a text file

Hi Techies I have written a script which is collecting the logs of job running on server and let mail me the output. I want to format column of output, please help. CCMS_BAU_from_CACHE RUN ETL_SUBSITE_TO_SITE_BAU RUN GetClient_Prep_Main RUN MDM_Client_BAU RUN Sweeper RUN... (11 Replies)
Discussion started by: atul9806
11 Replies

4. UNIX for Dummies Questions & Answers

Extracting the last column of a text file

I would like to extract the last column of a text file but different rows of the text file have different numbers of columns. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

5. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

Hi, I have a text file in the following format: Code: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 ... (2 Replies)
Discussion started by: evelibertine
2 Replies

6. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

I have a text file in the following format: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 13402 NA07019... (3 Replies)
Discussion started by: evelibertine
3 Replies

7. Shell Programming and Scripting

sort each column of text file alone

Hello , i have a text file like this 1 a1 ,AB ,AC ;AD ,EE 2 a2 ,WE ;TR ,YT ,WW 3 a3 ;AS ,UY ;RF ,YT i want to sort this text file based on each row , and excluding 2nd column from the sorting and not taking the comma or ; into consideration in the sorting, so it will become like this... (12 Replies)
Discussion started by: shelladdict
12 Replies

8. Shell Programming and Scripting

Finding the second last column value from a text file

Can any one tell me how to get the second last column value from the text file, which has different record size for each record. I know how to get the last column using awk and print statements, but I am unable to get the second last column value from the file. (4 Replies)
Discussion started by: naveen_sangam
4 Replies

9. Shell Programming and Scripting

Finding the last column value from a text file

Hi, I need to find out the last column value from a text file which is delimited by a tab. The issue here is the last column# for each record can be different i.,e, 1st record can have the last column as 15 and the second record can have the last column as "17". I have to search a string... (3 Replies)
Discussion started by: naveen_sangam
3 Replies

10. Shell Programming and Scripting

Add new column in Text File

I have one text file which is result of bdf command that have 6 fields separated by space and I want to add one new column in the beginning which is the name of the server because I have to insert whole thing into oracle table consisting of 7 fields THis is not a complete list but it looks... (9 Replies)
Discussion started by: pareshan
9 Replies
Login or Register to Ask a Question