Mac Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsMac Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 21st, 2007, 10:06 AM
Invalid02 Invalid02 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 216 Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 2 h 54 m 41 sec
Reputation Power: 11
Edit file using terminal

Hey,

I'm new to Mac and OS X - how would I go about editing an existing file, and writing a string to it just using terminal, and preferably without installing any addons to achieve this functionality?

Thanks for your time,

-Ross

[edit]

I should also mention, I need to pass the contents of the file in as arguments, not open up an editor then have to type them in...

Last edited by Invalid02 : June 21st, 2007 at 10:16 AM.

Reply With Quote
  #2  
Old June 22nd, 2007, 02:55 AM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 4 h 34 m 24 sec
Reputation Power: 787
Send a message via AIM to edman007
well you probably would have gotten a faster response if you asked this in the Linux forum as its the same answer

anyways, some text editors that are preinstalled on a Mac are pico and emacs, if you don't want a text editor (sounds like you just want to script this), but since you said you don't want an editor there are a few options

if your just adding a line to the end of the file this will work

bash Code:
Original - bash Code
  1. #put "my string" at the end of the file
  2. echo "my string" >> /path/to/file
  3. #or to read it out of a file
  4. cat /path/to/file1 >> /path/to/file2
  5. #the above will append file1 to file2
  6.  


if you need something else then you need to explain your situation better, to me it almost sounds like your looking to patch a file (and would need diff/patch) or your trying to edit a file which may be better suited for sed/awk
__________________
Feed ME

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsMac Help > Edit file using terminal


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway