![]() |
|
|
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 |
| Passing the values to the secondary script when it invoked by primary script | venu_eie | UNIX for Advanced & Expert Users | 2 | 07-03-2008 08:10 AM |
| Passing the values to the secondary script when it invoked by primary script | venu_eie | Shell Programming and Scripting | 1 | 07-03-2008 07:16 AM |
| create a shell script that calls another script and and an awk script | magikminox | Shell Programming and Scripting | 0 | 06-26-2008 03:50 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Looking for a Script
Hi All,
I have a small requirement in which i need to search for specific folders and bring out the file names in those folder and also the line 1 characters 49 to 17. It is possible to do this in UNIX. I am a beginner. Any help would be highly appreciated. Thanks Karan |
|
||||
|
For example
I have a folder "archive" in it i have a folder 0808 and 0809. Then I have a folder arc_transferred in both of them. Then multiple folders are there in arc_transferred. I am looking to search in these folders ...find out the file names and print the first line which is starting with XRI01 the characters 49 to 17. Hope this information helps. Thanks Karan |
|
||||
|
Code:
for file in archive/080[89]/arc_transferred/*; do
egrep '^.{48,61}XRI01' | head -1
done
You could do the same with a sed script, and avoid the for loop, but this is probably easier to extend and adapt if it doesn't work exactly the way you like. (Check if the egrep offsets are correct; your idea of "first" and "17 positions" might differ from mine.) |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|