title: extracting pcap name from a string using shell script or gawk
body: <p>i have a file pcap_list which contains the path of several pcap files for eg.</p>
  
  <pre><code>./folder1/folder2/...../foldern/sample1.pcap
  ./folder1/folder2/...../foldern/sample2.pcap    and so on....
  </code></pre>
  
  <p>from this i want to extract the name of pcap files using shell script in linux. can anyone let me know how i can do that . Though when i used 
      gawk 'BEGIN {FS = "/"} {print $NF}' pcap_list
  it worked fine. but i want to do this in a loop and wrote the following script for that. </p>
  
  <pre><code>#!/bin/bash
  PCAP_LIST=$1
  count=0
  cat $PCAP_LIST | while read PCAP_PATH
  do
          let count++
          echo "$count $PCAP_PATH"
  pcapname=($(gawk -v pcappath=$PCAP_PATH 'BEGIN {FS = "/"} {print $NF}' pcappath))
  printf "pcapname =$pcapname"
  done
  </code></pre>
  
  <p>it is not working. can anyone let me know how i can do that.
  any help will be greatly appreciated. thanks.</p>