The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
.
google unix.com



IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum.

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-11-2007
suzinor suzinor is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 4
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
  #2 (permalink)  
Old 09-11-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
Pls read the Rules - no duplicate posts.
Thread closed!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0