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 > Operating Systems > OS X (Apple)
.
google unix.com



OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
head followed by variable?? bashuser2 Shell Programming and Scripting 2 04-28-2009 07:23 AM
Search HEAD of CVS bobtheowl2 Shell Programming and Scripting 0 09-02-2008 07:12 PM
option followed by : taking next option if argument missing with getopts gurukottur Shell Programming and Scripting 2 03-17-2008 12:46 PM
head usage vasuarjula Shell Programming and Scripting 5 02-18-2008 02:33 AM
help.. I am in way over my head !!!! oberon42 UNIX for Dummies Questions & Answers 3 04-26-2002 11:13 AM

Reply
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 07-30-2009
mac_novice mac_novice is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 2
Question Help with head -q option on Mac OS X

I am trying to run a csh script (this is usually done on my Linux machine but it died, so I had to resort to a Mac ) and I received the following error message:

head: illegal option --q

My script takes multiple files as the input, concatenates them and produces a single file as the output. The line that is giving me issues is listed below:

head -1 -q input*.txt > output.txt

If I remove the -q option, it does still work; however, it is adding the name of each, individual file to output.txt.

From what I have read, OS X does not support the quiet or silent (-q)option. Does anyone know of another option that would give me the same result? Any suggestions would be greatly appreciated.
  #2 (permalink)  
Old 07-30-2009
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,724
try:
Code:
awk 'FNR==1 {print $0; exit} ' input*.txt > output.txt
  #3 (permalink)  
Old 07-30-2009
mac_novice mac_novice is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 2
Thanks for the reply, Jim. Sadly, the code caused only the first line of the first file to be written to the output file but ignored all the remaining files (there are 50 files in total).
  #4 (permalink)  
Old 08-01-2009
xbin xbin is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 5
Install Fink then install their coreutils 1:6.9-3 package. The head command in this package supports the --quiet option.
  #5 (permalink)  
Old 08-28-2009
sitney sitney is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 20
or

Code:
head -1 input*.txt | grep -v '==>' > output.txt
The Mac OS X head command outputs "==>" along with filename, so just delete that line and you should be good to go.
Reply

Bookmarks

Tags
head command, illegal option, multiple files, os x, quiet

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:09 PM.


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