![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ftp checking | ust | Shell Programming and Scripting | 0 | 07-10-2008 02:30 AM |
| Ksh Checking if string has 2 characters and does not contain digits? | developncode | UNIX for Dummies Questions & Answers | 1 | 04-08-2008 03:19 PM |
| EOF checking the below | ramkrix | High Level Programming | 10 | 03-11-2008 01:43 AM |
| Checking for PXE | maestro@altiris | SUN Solaris | 5 | 05-25-2004 12:06 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Checking for certain characters
Could anyone help with the following enquiry.. i have a file in the following format:
ID .... VALUE A001 .... 100 B002 .... 200 A004 .... 300 B006 .... 100 A997 .... 200 B776 .... 400 It is in a column format, but I want to check that the ID field always begins with with and A or B character this is my logic thus far: If Character 1 DOES NOT equal A or B then display error message else carry on doing what you want fi not really sure how to chech that character 1 of each line does not equal A or B habe tried following with no no joi If [ ! grep '^A' $file || ! grep '^B' $file ] then print "error" else print "it works" fi but the above does not work i believe it to logic as my unix understanding not great, please assist. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|