Sponsored Content
Top Forums Shell Programming and Scripting Inserting New Line in File using Sed ?? Post 302088920 by Mary_xxx on Friday 15th of September 2006 05:48:46 AM
Old 09-15-2006
Inserting New Line in File using Sed ??

Dear All,

I have a file called football where i have a list of 11 players each on different lines.
I wish to add a name of another player on the first line.
I have created a file called footballscript in vi writing the following sed command to achieve this ...

cat football | sed -e '1 i\ zidane' > newfootball

with newfootball the new output file

On the command line in UNIX i type sh footballscript to run the script but get the following error message;
sed: -e expression #1, char 5:Extra characters after command

Can ne1 point out my mistake or suggest an alternative sed code for this please?

Major thanks in advance

Mary
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

inserting a new line in a file

I'm sure you guys have answered this elsewhere but I can't seem to find where so here goes. #!/bin/bash n=120 a=$(sed '120q;d' energy.xvg) while ;do a=$(sed $n'q;d' energy.xvg) echo "$a \n" > newfile n=$(($n+100)) done exit 0 that script should read the file energy.xvg, start at... (1 Reply)
Discussion started by: gelitini
1 Replies

2. Shell Programming and Scripting

Need Help in Inserting a new line in a file using PERL

I need a perl script to find and replace a specific pattern in a file to a new line. BAsically I have a single line data in a file with 10 mb to 200 MB. I want to put a new line based on a specific pattern to open the file in Excel / Access. Following is the sample data in a file ... (1 Reply)
Discussion started by: portalfaq
1 Replies

3. Shell Programming and Scripting

inserting line to a file

I have posted it previously but somehow could not delete the previous post.I felt i could not explain the problem statement well. Here t goes.I have a file say File1. Now i need a specific pattern from the lines to be added to the other line. File: red blue green ABC.txt@ABC END black... (1 Reply)
Discussion started by: ngupta
1 Replies

4. Shell Programming and Scripting

Inserting IP in one line of a file

Hi, I have this line: ip=111.222.133.144,mac=00:16:3E:2A:08:3C,vifname=veth360','ip=10.2.3.4,vifname=veth360a' ^ | ------- I want to insert this IP 144.133.222.111 between "144"... (4 Replies)
Discussion started by: iga3725
4 Replies

5. Shell Programming and Scripting

Inserting a line in a file after every alternate line

Friends , I have a large file and i need to insert a line after every line.I am actually unaware how to do it.Any help appreciated. My File control station *ATM* , qread $OSS.Jul13A.FI01 interval 1 intcount 1 control station *ATM* , qread $OSS.Jul13A.FI02 interval 1 intcount... (4 Replies)
Discussion started by: appu2176
4 Replies

6. Shell Programming and Scripting

inserting line at particular linenumber using sed

Could anyone tell me how to insert a line at a particular line number using sed. sed '2i\newtext' filename I have tried the above command .But it is not working. I am using tcsh shell .Please help. Double post, continued here (0 Replies)
Discussion started by: maitree
0 Replies

7. Shell Programming and Scripting

Inserting a new line into an already existing file

hello .. I am new to perl scripting, I have a text file, and would like to insert 3 new lines into the same file at different line numbers using perl scripting. Any Help regarding this will be very useful. say the file is sample.txt, contents are aaaaa bbbb ccccc dddd eeeee ffffffff... (4 Replies)
Discussion started by: hemalathak10
4 Replies

8. Shell Programming and Scripting

Help with sed and inserting text from another file

I need to insert text from one file into another file after specific term. I guess sed is the best method of doing this and I can insert a specified text string using this script but I am not sure how to modify it to insert text from another file: #!/bin/sh sed 's/\<VirtualHost... (17 Replies)
Discussion started by: barrydocks
17 Replies

9. UNIX for Dummies Questions & Answers

Inserting text into a file with awk or sed

Hello, I've been trying to get a script working that fetches weather-data and converts it into an .ics file. The script works so far put I'm stuck at the point where I need to add specific static data. A thorough search through the forum did not point me into the right direction. #!/bin/bash... (3 Replies)
Discussion started by: Schubi
3 Replies

10. Shell Programming and Scripting

Inserting a line to a file

Hi, consider a file called mobile.txt as follows: For type lovers, add a new line at the end of it by copying its previous line and add a +1 to the field1, field2 Additionally, there are only 3 plans available to lovers type, so it should not work for lovers type already having 3 lines under... (11 Replies)
Discussion started by: Gautham
11 Replies
MONOP(6)							   Games Manual 							  MONOP(6)

NAME
monop - Monopoly game SYNOPSIS
/usr/games/monop [ file ] DESCRIPTION
Monop is reminiscent of the Parker Brother's game Monopoly, and monitors a game between 1 to 9 users. It is assumed that the rules of Mo- nopoly are known. The game follows the standard rules, with the exception that, if a property goes up for auction and there are only two solvent players, no auction is held and the property remains unowned. The game, in effect, lends the player money, so it is possible to buy something which you cannot afford. However, as soon as a person goes into debt, he must "fix the problem", i.e., make himself solvent, before play can continue. If this is not possible, the player's property reverts to his debtee, either a player or the bank. A player can resign at any time to any person or the bank, which puts the property back on the board, unowned. Any time that the response to a question is a string, e.g., a name, place or person, you can type `?' to get a list of valid answers. It is not possible to input a negative number, nor is it ever necessary. A Summary of Commands: quit: quit game: This allows you to quit the game. It asks you if you're sure. print: print board: This prints out the current board. The columns have the following meanings (column headings are the same for the where, own holdings, and holdings commands): Name The first ten characters of the name of the square Own The number of the owner of the property. Price The cost of the property (if any) Mg This field has a `*' in it if the property is mortgaged # If the property is a Utility or Railroad, this is the number of such owned by the owner. If the property is land, this is the number of houses on it. Rent Current rent on the property. If it is not owned, there is no rent. where: where players are: Tells you where all the players are. A `*' indicates the current player. own holdings: List your own holdings, i.e., money, get-out-of-jail-free cards, and property. holdings: holdings list: Look at anyone's holdings. It will ask you whose holdings you wish to look at. When you are finished, type "done". shell: shell escape: Escape to a shell. When the shell dies, the program continues where you left off. mortgage: mortgage property: Sets up a list of mortgageable property, and asks which you wish to mortgage. unmortgage: unmortgage property: Unmortgage mortgaged property. buy: buy houses: Sets up a list of monopolies on which you can buy houses. If there is more than one, it asks you which you want to buy for. It then asks you how many for each piece of property, giving the current amount in parentheses after the property name. If you build in an unbalanced manner (a disparity of more than one house within the same monopoly), it asks you to re-input things. sell: sell houses: Sets up a list of monopolies from which you can sell houses. It operates in an analogous manner to buy. card: card for jail: Use a get-out-of-jail-free card to get out of jail. If you're not in jail, or you don't have one, it tells you so. pay: pay for jail: Pay $50 to get out of jail, from whence you are put on Just Visiting. Difficult to do if you're not there. trade: This allows you to trade with another player. It asks you whom you wish to trade with, and then asks you what each wishes to give up. You can get a summary at the end, and, in all cases, it asks for confirmation of the trade before doing it. resign: Resign to another player or the bank. If you resign to the bank, all property reverts to its virgin state, and get-out-of-jail free cards revert to the deck. save: save game: Save the current game in a file for later play. You can continue play after saving, either by adding the file in which you saved the game after the monop command, or by using the restore command (see below). It will ask you which file you wish to save it in, and, if the file exists, confirm that you wish to overwrite it. restore: restore game: Read in a previously saved game from a file. It leaves the file intact. roll: Roll the dice and move forward to your new location. If you simply hit the <RETURN> key instead of a command, it is the same as typing roll. AUTHOR
Ken Arnold FILES
/usr/games/lib/cards.pck Chance and Community Chest cards BUGS
No command can be given an argument instead of a response to a query. 4th Berkeley Distribution May 6, 1986 MONOP(6)
All times are GMT -4. The time now is 06:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy