|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi, boss
i have a problem: i want display one column from a file. so i think i can used the awk -F"," '{print $number}' XXXX. but the file contain lots of the column,,,so i can confirm the line number which i need . so can some body help me to solve this issus....... PS: how can i display the any row or any column by the UNIX command? |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
The row will work with the awk statement you posted. for rows: Code:
awk 'NR==number" # where number is the row you want. or Code:
sed -n '2p' # where 2 is 2nd row |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
I know that, but how to check the number of the column? due the table is very big, and do i need count that manually? or can i filter that column by key words?
like: name class .............. age kevin 5 26 so i do not know the exactly column of the age, but i know there is a column include the "age" key words. can i filter that column by keywords? thanks very much! |
|
#4
|
|||
|
|||
|
how to display the 2nd coloumn from a file ........
for ex.... empno ename 1 scott 2 ford need to display 2nd coloumn how ? any help ? |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
i've moved this thread to "shell programming..." @naughty21 please don't capture old threads for new questions. just start a new thread in the right forum... for your question try this: Code:
cat /your/file | cut -d " " -f2 |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
to display second column Code:
awk '{print $2}' fileto know how many columns Code:
awk '{print NF}' file |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2 | rydz00 | Shell Programming and Scripting | 7 | 11-09-2010 10:28 AM |
| Search name and display column from a file | sillyha | Shell Programming and Scripting | 3 | 01-31-2010 09:58 PM |
| How to display the first column in a file? | isha_1 | Shell Programming and Scripting | 5 | 12-14-2009 12:25 AM |
| Changing one column of delimited file column to fixed width column | manneni prakash | Shell Programming and Scripting | 5 | 06-22-2009 05:27 AM |
| display column in a row | vivekshankar | UNIX for Dummies Questions & Answers | 2 | 05-23-2005 04:43 PM |
|
|