LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-14-2007, 08:30 AM   #1
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Rep: Reputation: 15
tcsh read command?


Hi.

I'm writing a shell script using tcsh - I have no choice in the matter; I'm utilising GMT (Generic Mapping Tools) which only runs from csh/tcsh.

In bash the read command is simple.

I'm having a bit of difficulty with it's counterpart in tcsh...

What I'm tring to do is to assign the number of lines in a file to a variable var
Code:
@ var = (wc -l file | awk '{print $1}' )
the @ is the set equivalent for numerical characters

but tcsh doesn't like this...

so I try the long way around:

Code:
wc -l file | awk '{print $1}' > temp.file
**READ** var < temp.file
- but I don't know the tcsh read syntax. It's something like $< but that's all I can get...

Would appreciate any help
 
Old 06-16-2007, 01:55 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hya,

I am having great difficulty understanding what you want. Can you describe what you want? Posting error message you get might be also helpful, but only when I know what you want to do.

Happy Penguns!
 
Old 07-13-2007, 07:53 AM   #3
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hi,

Is this what you want?
Code:
foreach a ("`wc -l *`")
@ b = `echo $a | tr -s ' ' | cut -f 1 -d ' '`
end
or
Code:
foreach a (`wc -l * | tr -s ' ' cut -f 2 -d ' '`)
@ b = a
end
Happy Penguins!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ESC+/ to search command history in tcsh wycolorado Linux - Newbie 1 06-30-2006 04:20 AM
ESC+/ to search command history in tcsh wycolorado Linux - General 0 06-28-2006 06:43 PM
Read command. unreal128 Linux - Software 2 09-30-2005 12:44 PM
"at" command under tcsh on RHE 3.0 dudleyp Linux - Software 0 11-18-2003 01:42 AM
Question about read command thepryme Linux - Newbie 1 10-22-2003 01:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration