Need help in implementing logic


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help in implementing logic
# 1  
Old 03-31-2011
Need help in implementing logic

i have following input file...
Code:
00290002STDR000000000000000000000000000EOD END TRANSACTION                            ^@^@^@^@^@^@^@^@^@^@^@^@^
00299998STDR070000000007000000000000000STANDING DEBITS                                ^@^@^@^@^@^@^@^@^@^@^@^@^
00299999STDR160000000016000000000000000STANDING CREDITS                               ^@^@^@^@^@^@^@^@^@^@^@^@^
00300000    000000000000000000000000002TDS 15H LIMIT DETAIL                           ^@^@^@^@^@^@^@^@^@^@^@^@^
00300010DFC 010000000001000000000000001CASH DEPOSIT                                   ^@^@^@^@^@^@^@^@^@^@^@^@^
00300015DFM 000000000001000000000000002MULTI DEPOSIT                                  ^@^@^@^@^@^@^@^@^@^@^@^@^
00300016DFC 010000000001000016000000002CASH DEPOSIT FOR FC ACCTS                      ^@^@^@^@^@^@^@^@^@^@^@^@^

$1 taken from user will be matched with 00016 (cut -c 4-8)
here i have to cut -c 40-86 to display CASH DEPOSIT FOR FC but the condition is that first 3 characters must be 003.

in short..
display CASH DEPOSIT FOR FC where $1=`cut c 4-8` and first 3 characters are 003...

Last edited by Franklin52; 04-01-2011 at 06:20 AM.. Reason: Please use code tags
# 2  
Old 03-31-2011
Code:
egrep "^003${1}" b1 | cut -c40-86

Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with implementing logging

I'm trying to add logging to an existing script which echos a number of lines to the screen. I've added a switch to the script that is going to suppress much of this output and put it in a file instead. The way I envisioned it was like this: $log would be set to either "" or the log files... (8 Replies)
Discussion started by: cheetobandito
8 Replies
Login or Register to Ask a Question