|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Awk search help
Hi, Want to know what does it returns. Code:
$ awk '$1 == /Jan/' inv $ awk '$1 = /Jan/' inv --- What does this one signify. 1 13 25 15 115 1 21 36 64 620 $ awk '$1 ~ /Jan/' inv Jan 13 25 15 115 Jan 21 36 64 620 Thanks in advance. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Dont know... You did not show us what was is the file inv for a start...
You also di not mention your OS (awk differ depending of OS you know...) |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
Code:
$ cat inv Jan 13 25 15 115 Feb 15 32 24 226 Mar 15 24 34 228 Apr 31 52 63 420 May 16 34 29 208 Jun 31 42 75 492 Jul 24 34 67 436 Aug 15 34 47 316 Sep 13 55 37 277 Oct 29 54 68 525 Nov 20 87 82 577 Dec 17 35 61 401 Jan 21 36 64 620 Feb 26 58 80 652 Mar 24 75 70 495 Apr 21 70 74 514 |
|
#4
|
||||
|
||||
|
In the second awk, you are assigning the outcome of /Jan/ (1 if true, 0 if false) to field 1.., in the first one, you are comparing 0 or 1 to the value of field 1.. What you are probably looking for is: Code:
awk '$1=="Jan"' inv or Code:
awk '$1==m' m=Jan inv |
| The Following User Says Thank You to Scrutinizer For This Useful Post: | ||
vanand420 (06-08-2012) | ||
| 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 |
| Binary Search Tree Search problem | meredith1990 | Programming | 1 | 02-27-2012 10:23 AM |
| sed help - search/copy from one file and search/paste to another | ncwxpanther | Shell Programming and Scripting | 5 | 08-21-2011 10:56 AM |
| Search files with specfic extention and later search content | lovi_v | UNIX for Advanced & Expert Users | 2 | 07-14-2008 12:05 PM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 09:24 AM |
| Advanced Search Problems.. Search by User Name | Neo | Post Here to Contact Site Administrators and Moderators | 1 | 05-19-2003 12:28 AM |
|
|