PLEASE HELP! Shell Script to do the following....
Dear All,
I've been trying to write a shell script that does the following, with no success! :(: - Read a file and search for a particular string - Redirect everything before that string to File1 - Redirect everything after that string to File2 I look forward to receiving help. Best Regards; Yow |
Code:
while read line |
Quote:
http://tldp.org/LDP/abs/html/ Break the task down into steps. How would you read a file? How would you search for a string? Save a position in a file? Even keying in "linux bash read file search for string" into Google pulls up lots of examples: http://linuxconfig.org/Bash_scripting_Tutorial |
Thanks for the response TBone, and I totally agree with you.
The reason I came here is because I wanted help quickly as I need this for something at work that needs to go live tonight. My problem is as follows: Lets say I have the following text file. What I need is a script to read the file and redirect the first conversation (Before "Disconnected", with Maria) to File1, and then the second conversation (After "Disconnected", with John) to File2. ===================== Hi Maria? How're you doing? I'm doing well, how about you? I'm good too. Disconnected Hi John, what's going on? It's been a while. ====================== I'll very much appreciate the response, and I need this badly :( |
Quote:
Quote:
So:
|
Code:
csplit bla.txt /Disconnected/ |
Quick and dirty script .
modify it as as need be. Code:
|
All times are GMT -5. The time now is 10:15 AM. |