Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
1. in TMP1 all delimiters are lost, wordsa are separated by spaces, not original ", ", which was in my example;
2. Output somehow becomes trippled original string represented by $line.
I'd be happy understanding why TMP1 acquired in the original way gives that error. (actually, if I use the TMP1 acquired in the way advised for insertion into Output in original way, I get the same error, so I assume everything hides within Output code line)
Last edited by BerzinTehvs; 07-26-2010 at 04:58 AM.
echo "hello, goodbye, rotten, apple, core" | \
awk -F ", " ' {RS=", "; n=split($0,arr); asort(arr); for (i = 1; i < n; ++i) print arr[i]", "; print arr[i]}'
while the example runs smoothly, in my script the resulting string anyway gets an extra comma at the end (and without ORS it crashes next awk with message about unterminated string)
so, I killed the last comma with
Code:
TMP2=`echo $TMP1 | sed '$s/.$//'`
Last edited by BerzinTehvs; 07-26-2010 at 11:46 AM.
Could you show a sample of exactly what the input file looks like (what it contains) as well as the exact output you desire? I'll have another look at it
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.