xxx.com
server version
dfsdfdfsd
asdafsf
---end---
diskspace
zdcdfzxcx
ZXccxvc
yyy.com
server version
w4ewr0as0dias90
324rwefdsok0
---end---
diskspace
.......
ddd.com
server version
ttt.com
diskspace
have four set of data, the first line is server name .com highlighted in blue.
if the server name found then it has to check server version (highlighted in red) and disk space (highlighted in purple) if both version and disk space present redirect to o/p1.txt file
if only disk space present redirect to another file o/p2.txt
if only server version redirect to other file o/p3.txt
Input file.txt
aaaa
server-version
dsfsrjjgorgk
sfoweiurtit
disk space
ldkosdife
dsfjioeufs
bbbb
server-version
fker9i5toek
dsfmeu90e
disk space
fsgter6y
sfe5t5gf
cccc
server-version
sdt4wtrei
sfd5tet
dddd
disk space
ssretr
dferte56y
eeee
server-version
.............
my requirement is need to pass all server name one by one (aaaa,bbbb,cccc,ddddd......)
once we pass server name need to check both server-version and disk space are available if yes then redirect to o/p file like below
output1.txt
aaaa
server-version
dsfsrjjgorgk
sfoweiurtit
disk space
ldkosdife
dsfjioeufs
bbbb
server-version
fker9i5toek
dsfmeu90e
disk space
fsgter6y
sfe5t5gf
If only server-version is available rediect another file
It has been a long time since I seen a thread that confused me as much as this thread.
Sometimes you have a list of servers; sometimes you have a file that contains a list of servers; sometimes the servers can just to be extracted from the data as the contents of the 1st line in an empty line separated group of lines.
Sometimes you are looking for lines that have server names like aaaa, bbbb, cccc, etc.; other times you have server names like aaaa.com, bbbb.com, cccc.com, etc. And, now you are looking for server name "server-version"???
Sometimes you're looking for lines that contain "server version"; other times you're looking for lines that contain "server-version".
Sometimes you're looking for lines that contain "diskspace"; other times you're looking for lines that contain "disk space".
Every time someone gives you some code to try, you say it doesn't work and show us new sample data that contains different strings to match.
Sometimes you want data in a file that contains complete groups in three files; now you just want server names in file 0!
Please take a LARGE step back, look at the data you want to process, show us a representative sample of the data you want to process *using CODE tags), show us all of the corresponding output files that should be produced from that sample input (all using CODE tags), and provide a simple English description of the logic that determines how the input file is supposed to be transformed into the various output files.