![]() |
|
|
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 |
| Back-to-Back Connection using HBAs | aldowsary | IP Networking | 3 | 11-28-2008 10:21 PM |
| back to back printing in UNIX | amirthraj_12 | AIX | 3 | 05-06-2008 08:42 AM |
| ksh93 deprecation... | curleb | Shell Programming and Scripting | 2 | 03-17-2008 08:36 PM |
| Strange array handling in ksh93 | bakunin | Shell Programming and Scripting | 3 | 10-24-2005 01:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Using subsring in ksh93 - How to stuff a byte back in
Code:
#!/bin/ksh93 # set to ksh93 so we can use substring
cat "file" |
while IFS=\n read I # read the next record into I
do # do not parse out blanks, tabs in the record by setting IFS to newline char only
D1=${I:27:1} # isolate byte 27 into D1
if [[ "$D1" = " " ]] # if byte 27 = a blank
then
${I:27:1}="-" # change byte 27 to a dash "-" <-- ### WARNING, this syntax is invalid ###
else
: # no change to byte 27
fi
print "$I" # write out record
done
A question on the above code:
Last edited by The Doctor; 03-26-2006 at 12:31 AM.. Reason: changed commas to colons in ${I:27:1} |
|
||||
|
Quote:
thx for taking the time to answer.... your solution --> Quote:
Last edited by The Doctor; 03-26-2006 at 12:41 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|