![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Using awk
Hi,
I am trying to write a program that reads the users file, list them and allow user to view/delete the their files but was having problem with the awk statement. Here is my code: find . -user "`whoami`" -type f -exec ls -ld \{\} \; > `whoami`tmp cat -n `whoami`tmp | more echo "V(VIEW), D(DELETE), Q(QUIT)." echo "\t\t Enter selection : \c" read answer arg1 arg2 arg3 echo case $answer in V|v) echo $answer $arg1 $arg3 awk -F/ 'NR==$arg1,NR==$arg3 {print $2}' `whoami`tmp|while read filename;do more $filename done;; # D|d) awk 'NR == 2 , NR == 2 {print $9}' skvart|while read f ilename; do # rm -f $filename #done;; Q|q) exit 0;; *) echo "\t\t Invalid option" esac done exit 0 My issue is that when I did the following it works: awk -F/ 'NR==2,NR==4 {print $2}' suzitmp but in my program awk -F/ 'NR==$arg1,NR==$arg3 {print $2}' `whoami`tmp|while read filename;do echo $filename done;; It display nothing. If anyone can help me please. Thank you |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|