I have a text file that looks like this:

```
domain name pointer www.google.com
domain name pointer www.gmail.com
NA
domain name pointer www.facebook.com
NA
NA
NA
domain name pointer www.starbucks.com

```

IF I use these commands:

```
grep "pointer" inputfile.txt | awk '{print $4}'

grep "NA" inputfile.txt | awk '{print $1}'

```

I am able to get:

```
www.google.com
www.gmail.com
www.facebook.com
www.starbucks.com
NA
NA
NA
NA

```

However I would like the 'NA' and URLS to stay in the same order as the original text file.