nth Columns in a Tab delimited file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers nth Columns in a Tab delimited file
# 8  
Old 02-26-2010
OUTPUT:-

cat -vet file


5^I220730^I1587652^I^I^I^I1^IHCAT^I^I^ISTD^I^I101^I^I^I^I^I^I^I^I^I01/08/2007^I^IGBP^IG^I^I^I1^I^I793165^I^I^I^I^I^IUK^I^I10045^I25/09/2007^IUK^I^IKK^I^I^I^I^I^I^I^I^I^I900593^I^I^I^I^I^I31/08/2008^I^I^I^I^I^IUK^IA^I^I^I^IC^I^I10101^I^I^I^I^I^I^I^I^I^I^I^I^I^I^I^I^I^IY^I25^IN^I^IN^I^I^I^I^I^I ^I^I^I^I^I^ISMA83^IN^I^I^I^I^I^I^I^I^I^IC^I^I^I^I^I^ISTD1^I01/08/2007^I^I^I^I^I^I^I^I^I^I^I^I^I^I^IN^I^I$


awk -F " " '{ print $4 }' file.

Its output coming as blank.
# 9  
Old 02-26-2010
Code:
5^I220730^I1587652^I^I^I^I1^IHCAT^I^I^ISTD^I^I101^I^I^I^I^I^I^I^I^I01/08/2007^I^IGBP^IG^I^I^I1^I^I793165^I^I^I^I^I^IUK^I^I10045^I25/09/2007^IUK^I^IKK^I^I^I^I^I^I^I^I^I^I900593^I^I^I^I^I^I31/08/2008^I^I^I^I^I^IUK^IA^I^I^I^IC^I^I10101^I^I^I^I^I^I^I^I^I^I^I^I^I^I^I^I^I^IY^I25^IN^I^IN^I^I^I^I^I^I ^I^I^I^I^I^ISMA83^IN^I^I^I^I^I^I^I^I^I^IC^I^I^I^I^I^ISTD1^I01/08/2007^I^I^I^I^I^I^I^I^I^I^I^I^I^I^IN^I^I$


Yes it will show null as the 4th filed is null . See the marked tab's

Last edited by amitranjansahu; 02-26-2010 at 06:43 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies

2. UNIX for Dummies Questions & Answers

Need to convert a pipe delimited text file to tab delimited

Hi, I have a rquirement in unix as below . I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column. ex: Input Text file: 1|A|apple 2|B|bottle excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies

3. Shell Programming and Scripting

Delete and insert columns in a tab delimited file

Hi all , I have a file having 12 columns tab delimited . I need to read this file and remove the column 3 and column 4 and insert a word in column 3 as "AVIALABLE " Is there a way to do this . I am trying like below Thanks DJ cat $FILENAME|awk -F"\t" '{ print $1 "\t... (3 Replies)
Discussion started by: Hypesslearner
3 Replies

4. Shell Programming and Scripting

Remove blank columns from a tab delimited text file

Hello, I have some tab delimited files that may contain blank columns. I would like to delete the blank columns if they exist. There is no clear pattern for when a blank occurs. I was thinking of using sed to replace instances of double tab with blank, sed 's/\t\t//g' All of the examples... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

5. Shell Programming and Scripting

Help with converting Pipe delimited file to Tab Delimited

I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use cat file | sed 's/|//t/g' The above command substituted "/t" not tab in the place of pipe. Sample file: abc|123|2012-01-30|2012-04-28|xyz have to convert to: abc 123... (6 Replies)
Discussion started by: karumudi7
6 Replies

6. UNIX for Dummies Questions & Answers

Deleting columns from a tab delimited text file?

I have a tab limited text file with 10000+ columns. I want to delete columns 6 through 23, how do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

7. UNIX for Dummies Questions & Answers

How to convert text to columns in tab delimited text file

Hello Gurus, I have a text file containing nearly 12,000 tab delimited characters with 4000 rows. If the file size is small, excel can convert the text into coloumns. However, the file that I have is very big. Can some body help me in solving this problem? The input file example, ... (6 Replies)
Discussion started by: Unilearn
6 Replies

8. Shell Programming and Scripting

So I converted columns to rows but I want it to be tab delimited and also I want.....

Hi, So my file looks like this: title number JR 2 JR 2 JR 4 JR 5 NM 5 NM 8 NM 2 NM 8 I used this line that I wrote to convert it to rows so it will look like this: awk -F"\t" '!/^$/{a=a" "$3} END {for ( i in a) {print i,a}}' occ_output.tab > test.txt JR 2 2 4 5 NM 5 8... (4 Replies)
Discussion started by: kylle345
4 Replies

9. UNIX for Dummies Questions & Answers

Adding EMPTY columns to Tab-delimited txt file

Hi I have a txt file with 4 columns where I need to add 4 empty columns in the middle meaning that I need what is currently column 4 to be column 8 in a new file. The idea is that I have to use the file as input in a program that reads the data in column 1 and 8, so the content of the other... (8 Replies)
Discussion started by: Banni
8 Replies

10. Shell Programming and Scripting

Reading columns in tab delimited file

I want to read only one column in "|" delimited file and write that column to a new file. For Ex: Input File 1|abc|324|tt 2|efd|11|cbcb 3||1|fg 4|ert|23|88 Output : I want to read column 3 in diff file. 324 11 1 88 Can anyone give me inputs on this ? (2 Replies)
Discussion started by: net
2 Replies
Login or Register to Ask a Question