Sample input:
Loading File System
Networking in nature
Closing the System
now i need to extract the patterns between the words File and Closing:
i.e. sample output:
System
Networking in Nature
Thanks in advance !!!!!!!!!!!!!!!!!
Sample input:
Loading File System
Networking in nature
Closing the System
now i need to extract the patterns between the words File and Closing:
i.e. sample output:
System
Networking in Nature
Thanks in advance !!!!!!!!!!!!!!!!!
This is a bit clumsy but it seems to do what you want...
cat <file> | sed 's/.File //' | sed 's/Closing.$//'
yes indeed. you don't need the cat, and you can just use one sed command. Not very good with sed, but just an example.
sed -e 's/.*File //' -e 's/Closing.*$//' file
Thanks Guys !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
but if suppose i have an input like this:
Unix Shell scripting
Java Framework
Network Administrator
Perl Shell scripting
now i need to extract the patterns between "Java" and "Administrator"
so that my output should be
Framework
Network
one way
awk '/Java/{flag=1;}
/Administrator/{print ;flag=0}
flag { print }' "file"
i leave it to you to try remove "Java" and "Administrator"
U can also use sed:
sed -n "/Java/,/Administrator/p" file
Hi, you can try this one also:D.
awk 'BEGIN{f=0}
{
if (index($0,"File")!=0)
f=1
if (index($0,"Closing")!=0)
f=0
if (f==1)
{
if (index($0,"File")!=0)
printf("%s\n", substr($0,index($0,"File")+4,length($0)-index($0,"File")-3))
else
print
}
}' a