Is there a way to get a range of lines from a file??? I want to search through a set of scripts and need to select the group of lines which do the FTP.
Say,
Line1
Line2
ftp SERVER
user UNAME PASS
send FILE_TO_BE_SENT
close
Line3
Line4
Line5
ftp SERVER1
user USER1 PASS1
send FILE_TO_BE_SENT_1
Line6
Line6
From the above code fragments, I need to select the lines where the FTP is happening...
ftp SERVER
user UNAME PASS
send FILE_TO_BE_SENT
ftp SERVER1
user USER1 PASS1
send FILE_TO_BE_SENT_1.
Using grep, i am not able to do this.. and sed also has not came handy. Is there any ways??
@anchal_khare
It was just an example code which simulates my scenario. Thanks for the suggestion.
@dr.house
My system do not support grep with keyword -A. Unfortunately I cannot use it. But if I need to , I will get a GNU grep and will surely use ur suggestion. Thanks for your suggestion.
@rujuraha
Your suggestion worked fine for me. Lots Of Smiles and Thank you.
@Franklin52
I am in the process of learning awk. Thanks for your suggestion. I will use it.
@alister,
I am a bit hesitant to use sed. I dont know exactly. Anyway thanks for ur suggestions.
Thanks All for those replies... I am able to go to the next level of my project. unix.com always rocks. Keep up the good work.