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 > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Simple Script mojoman Shell Programming and Scripting 6 05-12-2008 03:55 AM
simple script ali560045 Shell Programming and Scripting 1 01-22-2008 04:41 AM
Simple Script Help Skunkie UNIX for Dummies Questions & Answers 4 10-02-2006 11:18 AM
simple awk script... moxxx68 Shell Programming and Scripting 3 01-24-2005 04:17 AM
simple script hedrict UNIX for Dummies Questions & Answers 4 02-23-2004 04:15 PM

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

Join Date: Sep 2006
Posts: 16
need help with simple awk/ksh script

I need help finding out why this script wont run. The chmod is okay, but i get an error saying that I need '&&' on line 5.


Quote:
#! /bin/ksh

read x

for file in 'ls -al | awk '$6 == "Sep" && $7 < 18 , $6 != "Sep"'

do

mv $file ~/compressed.tar/$file
read x

done

tar -cvf compressed.tar
  #2 (permalink)  
Old 09-27-2006
Andrek Andrek is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 122
I think you missing a single quote '
  #3 (permalink)  
Old 09-27-2006
tefflox tefflox is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 16
it still says i need '&&' on line 5... does everything else look right?
  #4 (permalink)  
Old 09-27-2006
tefflox tefflox is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 16
Question

here is how it looks now

Quote:
#! /bin/ksh

read x

for file in 'ls -al | awk '$6 == "Sep" && $7 < 18''

do

mv $file ~/compressed.tar/$file
read x

done

for file in 'ls al | awk '$6 != "Sep"''

do

mv $file ~/compressed.tar/$file
read x

done

tar -cvf compressed.tar
  #5 (permalink)  
Old 09-27-2006
hitmansilentass hitmansilentass is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 37
try this
Code:

#! /bin/ksh
read x

for file in `ls -al | awk $6 == "Sep" && $7 < 18''`
do
mv $file ~/compressed.tar/$file
read x
done

for file in 'ls al | awk '$6 != "Sep"''
do
mv $file ~/compressed.tar/$file
read x
done

tar -cvf compressed.tar
Anyways, what are you trying to achive here??
  #6 (permalink)  
Old 09-27-2006
tefflox tefflox is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 16
i get

Quote:
mv: 18 not found

mv: "Sep" not found

tar: Missing filenames
but no more '&&' needed in line 5... thanks for helping.
  #7 (permalink)  
Old 09-27-2006
hitmansilentass hitmansilentass is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 37
Oops try this
Code:
read x

for file in `ls -al | awk '{$6 == "Sep" && $7 < "18"}'`
do
mv $file ~/compressed.tar/$file
read x
done

for file in 'ls al | awk '{$6 != "Sep"}'
do
mv $file ~/compressed.tar/$file
read x
done

tar -cvf compressed.tar sourcefilename
Sponsored Links
Closed Thread

Bookmarks

Tags
mtime

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 07:11 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