![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple loop | eugenes18t | UNIX for Dummies Questions & Answers | 5 | 07-09-2009 12:01 PM |
| Simple using For loop | vincyoxy | Shell Programming and Scripting | 2 | 03-18-2009 03:40 AM |
| simple while loop | ali560045 | Shell Programming and Scripting | 10 | 12-26-2007 10:44 AM |
| simple for loop | ali560045 | Shell Programming and Scripting | 3 | 12-17-2007 01:39 AM |
| a simple while loop | syno | Shell Programming and Scripting | 5 | 04-08-2006 07:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
simple for loop/cat issue
ok.. so problem is: I have a file that reads: cat 123 Code:
1 and 2 3 and 4 5 and 6 I was using for loops to run through this information. Code: Code:
for i in `cat 123` do echo $i done shouldn't the output come as Code:
1 and 2 3 and 4 5 and 6 ...(1) rather, its coming as : Code:
1 and 2 3 and 4 ..... something like this...using ksh here... lemme know what the issue is..I want to display output as (1)...no code alternatives pls..just was wondering what was wrong in this code.. thanks..! Last edited by vgersh99; 09-30-2009 at 07:08 PM.. Reason: code tags, PLEASE! |
|
||||
|
no. this is because its using the default characters for $IFS(internal field separator) which is white space. set IFS='\n' prior to your loop and you should get what you expect. I would wrap your variable in double quotes though.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|