![]() |
|
|
|
|
|||||||
| 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 | Thread Starter | Forum | Replies | Last Post |
| read a variable character by character, substitute characters with something else | vipervenom25 | UNIX for Dummies Questions & Answers | 2 | 06-06-2008 12:18 PM |
| Korn: How to loop through a string character by character | shew01 | Shell Programming and Scripting | 9 | 05-29-2008 06:47 AM |
| replace a character with another character | satish@123 | Shell Programming and Scripting | 4 | 05-19-2008 02:57 AM |
| Can i read a file character by character | karnan | Shell Programming and Scripting | 6 | 05-18-2008 11:22 PM |
| Can I read a file character by character? | murtaza | Shell Programming and Scripting | 3 | 03-29-2007 08:19 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Setting FS to more than one character
Hi!
In an awk tutorial i was reading (from www.grymoire.com), it was mentioned that i can set the input field separator to more than one character using FS. However when i tried it out, it wasnt working. File a : abc/:/:as as/:f/:f AE/:/:as/:/:s script a.sh #!/bin/awk -f BEGIN { FS="/:"; } { print $1, $2; } command: home/# as.sh<a abc : as :f AE : however, the output i shud get is abc as f AE can someone tell me what am i doing wrong here? |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
|
|
|||
|
Solaris has a crippled version of awk - which is the default. It also has nawk which is more like new awk and supports features.
There are POSIX standards for awk which came out long after the awk version Solaris has... see: http://www.opengroup.org/onlinepubs/...ities/awk.html POSIX is a set of standards developers of most flavors of UNIX try to follow. This allows, for example, somebody here running Linux to get an example from someone else on this forum - that other person runs Solaris - and there will be a good chance it works on both boxes. Solaris doesn't play POSIX with awk, but it's there to support old code. Just use nawk and forget awk. IMO. |