![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 | Thread Starter | Forum | Replies | Last Post |
| Sorting your data with msort | iBot | UNIX and Linux RSS News | 0 | 05-19-2008 08:20 AM |
| sorting data using array in ksh | ali560045 | Shell Programming and Scripting | 4 | 12-04-2007 01:26 AM |
| Sorting blocks of data | alfredo123 | Shell Programming and Scripting | 8 | 07-05-2007 07:53 AM |
| Newbie Awk data sorting | i_am_a_robot | Shell Programming and Scripting | 5 | 05-04-2007 04:33 AM |
| Recovering lost folders/files data | Yorgy | UNIX for Dummies Questions & Answers | 0 | 03-15-2007 02:46 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#22
|
|||
|
|||
|
Try this one:
Code:
awk -v path="/path/too/" -F "|" '{print $0 > path $1}' file
|
| Forum Sponsor | ||
|
|
|
#23
|
|||
|
|||
|
> uname -a
SunOS e2dsavcshrdev01 5.8 Generic_117350-52 sun4u sparc SUNW,Sun-Fire-880 SunOS release 5 How do I find sed and awk versions |
|
#24
|
|||
|
|||
|
See if using /usr/xpg4/bin/awk works better than /usr/bin/awk or /bin/awk
|
|
#25
|
|||
|
|||
|
hi Franklin,
awk -v path="/export/home/vinay/" -F "|" '$1 == "AAA" {print $0 > path $1}' number.dat gives an error: awk: syntax error near line 1 awk: bailing out near line 1 Please help me if possible Era I could not get your comment #24. Regards, Vinay |
|
#26
|
|||
|
|||
|
You don't have /usr/xpg4/bin/awk on your system, or you didn't understand how to try it? Use the full path name instad of just "awk"; or try "nawk" instead of "awk" (if I understand correctly, that's identical to XPG4 awk, on the Sun box I have access to at least).
|
|
#27
|
|||
|
|||
|
Quote:
Regards |
|
#28
|
|||
|
|||
|
Hi Franklin, Era Shiva, Unix gurus,
I finally got the answer. The script you suggested works. It goes like this: /usr/xpg4/bin/awk -F '|' '$1 == "AAA" { print >"/export/home/vinay/AAA.dat";} $1 == "BBB" { print > "/export/home/vinay/BBB.dat";}' number.dat Truly good. Thanks a lot for your support . Now I am able to use it in my project. But one small doubt with respect to comment #13.. I am not able to give my desired path.. sed -e '/^AAA /w/export/home/cmohanku/vinay/AAA1.dat' -e '/^BBB /w/export/home/cmohanku/vinay/BBB1.dat' a.dat isnt woking. Kindly assist if possible. Another round of thanks to Franklin, Era, Shiva Regards, Vinay |
|||
| Google The UNIX and Linux Forums |
| Tags |
| regex, regular expressions, solaris |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|