grep 7th column from a file seperated with ^


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users grep 7th column from a file seperated with ^
# 1  
Old 12-10-2010
grep 7th column from a file seperated with ^

Hi,

Can anyone help:

I want to get the 7th column of a file seperated by ^

Num:^ 1^ testdevice1^10.1.1.1^PT1X23^true^HD^175^up^false^bad
Num:^ 2^ testdevice2^10.1.1.2^ST1X23^true^SN^175^up^false^bad

Expected result:
HD
SN

Appreciate your help.
# 2  
Old 12-10-2010
Code:
awk -F\^ '{ print $7 }' < file

# 3  
Old 12-10-2010
Code:
cut -d^ -f7 file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Seperated a Column from 'ESC' Character seperated file

Hi Experts I have an escape seperated fields in the unix file. And in the below format file I need to extract the first column. Please help its urgent. cat -v op.dat | head 24397028^ I want to extract the file in below format ( with only first column ) 24397028 2439707 thanks. ... (6 Replies)
Discussion started by: neha_suri06
6 Replies

2. Shell Programming and Scripting

Need Help in rearranging the content of a file comma seperated

I have a file with the below content a = test1 b = test2 a = test3 b= test4 c = test6 b = test5 d = test7 d = test9 Need the output to be as follows a = test1,test3 b = test2, test5 c = test6 d = test7, test9 (4 Replies)
Discussion started by: iron_michael86
4 Replies

3. Shell Programming and Scripting

Seperated by columns, merge in a file, sort them on common column

Hi All, I have 4 files in below format. I took them as an example. File 1: Cut from position 1-4 then 6-7 then 8-14 then rest left and make them as columns in one new file. Inserting character H to the initial of all line like HCTOT. CTOT 456787897 Low fever CTOR 556712345 High fever... (2 Replies)
Discussion started by: Mannu2525
2 Replies

4. Shell Programming and Scripting

How to awk or grep the last column in file when date on column contains spaces?

Hi have a large spreadsheet which has 4 columns APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96034 Storage Mgmt Team APM00111803814 server_2 96152 GWP... (6 Replies)
Discussion started by: kieranfoley
6 Replies

5. Shell Programming and Scripting

Need to grep column 2 value from second file

Hi, Here is the scenario. I have 2 files:- File 1 I1 1 I2 2 I3 3 File2 I2 2.1 I1 1.1 I3 3.1 Now what I want is :- I1 1 1.1 I2 2 2.2 I3 3 3.1 I tried using simple awk and grep commands and it works on small files, but am facing huge runtime issue with my actual files (in... (3 Replies)
Discussion started by: atulrawat11
3 Replies

6. UNIX for Dummies Questions & Answers

Grep from specific column in one file based on another file [Please help!]

Hey Guys, to keep it simple, I have an idFile: 1006006 1006008 1006011 1007002 ...... and famFile: 1006 1006001 1006016 1006017 1 1006 1006006 1006016 1006017 1 1006 1006007 0 0 2 1006 1006008 1006007 1006006 2 1006 1006010 1006016 1006017 2 1006 1006011 1006016 1006017 1 1006... (2 Replies)
Discussion started by: Zoho
2 Replies

7. Shell Programming and Scripting

Convert comma seperated file to line seperated.

Hi, I have data like this. 1,2,3,4 Output required: 1 2 3 4 I am trying to use tr function but getting error. Help is appreciated. (6 Replies)
Discussion started by: pinnacle
6 Replies

8. Shell Programming and Scripting

Removing blank lines from comma seperated and space seperated file.

Hi, I want to remove empty/blank lines from comma seperated and space seperated files Thanks all for help (11 Replies)
Discussion started by: pinnacle
11 Replies

9. Shell Programming and Scripting

A script that read specific fileds from the 7th line in a file

Dear All, I need a unix script that will read the 7th line and especially these fileds from a file Mo speed 16, Mt speed 15 every 15 minutes starting from 00:00 to 23:45 on daily basis and put the result in a txt file and name it MT_MO_20090225.txt, please also note that the system date format... (2 Replies)
Discussion started by: samura
2 Replies

10. UNIX for Dummies Questions & Answers

delete 7th column in unix

Hello., i have a file with 15 column. i want to remove the 7th column from the file. i am trying to use awk to delete the 7th column. can anyone help me how to do this thanks (6 Replies)
Discussion started by: pavan_test
6 Replies
Login or Register to Ask a Question