Extracting data from between double quotes

Need assistance , Below is the data between double code .

</td><td><a href="geavg.t00z.pgrb2af18">geavg.t00z.pgrb2af18</a>

Below commands gives me the result but i want everything in one command using single nawk

 nawk -v RS="< href" -F">" '/t00z/ { print $1 }' ucar.output | nawk -F '"' '{print $2}'

result i need

geavg.t00z.pgrb2af18

Hello,

Could you please use the following code.
Let us say a is the variable which have input given by you.

a=`echo </td><td><a href=geavg.t00z.pgrb2af18>geavg.t00z.pgrb2af18</a>`
echo $a | awk -F"\>" '{print$4}' | sed 's/\<\/a//g'

Output will be as follows.

geavg.t00z.pgrb2af18

Thanks,
R. Singh

A sed alternative:

$ sed 's/.*href="\([^"]*\).*/\1/' file
geavg.t00z.pgrb2af18

RavinderSingh13

My code below works ,I cannot take that code into a variable since its a huge file which i am trying to get geavg.t00z.pgrb2af18 files and many more like this

nawk -v RS="< href" -F">" '/t00z/ { print $1 }' ucar.output | nawk -F '"' '{print $2}'

i want to use only one nawk instead of two nawk. let me know if there is a better way .

Then you should give us the file ucar.output and example on output.
This way we could help you without guessing.

What about

awk -F"\"" '/t00z/ {print $2}' file

?

Just using string manipulation...

var='</td><td><a href="geavg.t00z.pgrb2af18">geavg.t00z.pgrb2af18</a>'
var1="${var##*href\=\"}"
var2="${var1%\"\>*}"
echo "$var2"

output

geavg.t00z.pgrb2af18

Try something like this:

awk -v RS=\< -F\> '/href.*t00z/{ split($1, F, /"/); print F[2] }' file

--
@ajayram: If it is nawk you are using, then you can only use a single character for RS
@briandanielz: It is a huge file

Yes. My bad for not being specific. I was just posting how to extract the variable.

I was thinking loop over the file with an array..
pseudo (untested)

while read line
	do
	    name=$line
	    if [[ $line == *fooBar* ]]; then #Some Search condition 
		line1="${line##*href\=\"}"
		line2="${line1%\"\>*}"
		array+=("$line2")
	    fi
	done < $file

I'm confused: Are you briandanielz or are you ajayram_arya? Both of you seem to be answering questions about what is wanted and posting very similar segments of code that you're using to solve parts of the problem.

Shell array sizes in both ksh and bash are limited. Since your input is a "huge file", the shell array limits may be your problem.

What are you going to do with the array after you have processed your "huge file"? Can't you instead process the data from each line in your huge file as you find it without keeping a list of that data from all of the lines you've processed in an array?

I would most likely read the file into a variable file stored in a trap directory. So upon completion or error the data, would be gobbled up.