Link to home
Start Free TrialLog in
Avatar of mac_g
mac_gFlag for Saudi Arabia

asked on

shell script : how to extract file content before after a search string for the files in directory

I want to read the file contents before and after search string. The contents may be 25 or 50 chars will be fine.

example :  file01
-------------------------
A better description inspires a more informed "discussion". The more details you include, the better equipped our community is to help you find a solution.

I want extract strings before & after discussion  in the above file given as output.

The output should display  in below format :
before 25 chars + search string  + 25 chars



Avatar of David Favor
David Favor
Flag of United States of America image

This is best done writing a custom script in PERL or Python.

If you try doing this as a Linux command pipeline, likely the pipeline will be far more fragile + complex, than a script.
ASKER CERTIFIED SOLUTION
Avatar of simon3270
simon3270
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mac_g

ASKER

@simon3270 .... thank  you
working perfect ..


Avatar of mac_g

ASKER

working .. .thanks

Closing this thread