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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
simple sed question funksen Shell Programming and Scripting 10 04-08-2007 05:54 PM
sed - simple question scotty_123 Shell Programming and Scripting 13 03-29-2007 02:23 AM
Simple C question... Hopefully it's simple Xeed High Level Programming 6 12-15-2006 02:29 PM
Ok simple question for simple knowledge... Corrail UNIX for Dummies Questions & Answers 1 11-28-2005 01:03 PM
Simple ksh question frustrated1 Shell Programming and Scripting 1 11-05-2003 12:41 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 03-04-2008
aforball aforball is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1
Simple Question

Hi Guys,
I've been learning UNIX for the past couple of days and I came across this exercise, I can't get my head around it, so I would be ever so grateful if I could receive some sort of help or direction with this.

Create a file with x amount of lines in it, the content of your choice.
Write a script named 'firstline' that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.
Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file.


The problem I have is that I dont know how to edit a text using shell scripts.

Any help would be greatly appreciated

Thanks,
aforball
  #2 (permalink)  
Old 03-04-2008
kskywr kskywr is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 13
You can use ex or sed among other things. This kinda seems like homework.
  #3 (permalink)  
Old 03-04-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,568
I agree it looks very homework...
If you need help start by giving us the work you have done, and explain what isnt working...
>The problem I have is that I dont know how to edit a text using shell scripts.
there is no need of shell scripts yet...
What can be used to display files in unix? (that was the first question you should be able to answer!)
well : cat, more, pg-page, head tail, od...
  #4 (permalink)  
Old 03-04-2008
ilak1008 ilak1008 is offline
Registered User
  
 

Join Date: May 2005
Posts: 64
Quote:
Originally Posted by aforball View Post
Hi Guys,
I've been learning UNIX for the past couple of days and I came across this exercise, I can't get my head around it, so I would be ever so grateful if I could receive some sort of help or direction with this.

Create a file with x amount of lines in it, the content of your choice.
Write a script named 'firstline' that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.
Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file.


The problem I have is that I dont know how to edit a text using shell scripts.

Any help would be greatly appreciated

Thanks,
aforball
Learn how to use visual editor or vi. It would surely help you a lot in editing text in shell scripting.
Sponsored Links
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 05:43 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