I have a file called 1.txt, I want to create 2.txt through 100.txt using a for loop. In each instance of the loop, I want to change all "1"'s in the text file to "2"s and so on...
I tried the code below to do this:
but it simply changes the 1's to $i, and not 2 through 100. How can I fix this code? Thanks!
I have a hostnames file which has:
$ cat hostnames.txt
serverxx1
serverxx2
serverxx3
My script:
#!/bin/sh
fileA=build.xml
for i in ./hostnames.txt ; do
sed 's/createConfig machine="Machine"/createConfig machine=" '$i' "/g' "$fileA" > ./tmpfile
done
FileA has:
createConfig... (2 Replies)
dear guys,
I want to replace the beginning of some lines in a file by (,)
The sequence number of lines is located in a file named numbers
so, i used this simple script to do so, but it didn't work. it does'nt recognize the $j in the command sed
#! /bin/sh
for j in `cat numbers`
do
sed '$j... (6 Replies)
So I am back again beating my head against the wall with a shell script and getting a headache! I want to change each year in a file (1980, 1981, 1982, 1983, etc.) to the same year followed by a tab.
The input is "blah blah (1980) blah blah".
I want to get "blah blah (1980 ) blah blah".... (2 Replies)
Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line.
... (1 Reply)
Hi there,
I have 1 file with different 144 lines and 144 files that I want to change with a sed.
What I want to do is to go trough the file with the 144 different lines take the line a replace a certain pattern with said in the first file of the folder where the 144 files are. Take the second... (3 Replies)
Hi,
im having problem creating a loop using my code: aside from the fact that the 1st variable (VAR) does not increment, it loops more than the expected output.
for sample purposes, test csv contains 3 lines.
#get number of lines in the file
lines=$( wc -l < test.csv )
... (5 Replies)
I have a file MAT.txt which contains the following data:
mat1.txt
mat2.txt
.
.
.
.
mat100.txt
I want to remove the '.txt' from every line and have an output file with the following data:
mat1
mat2
.
.
.
.
mat100
I know this can be done with sed easily for each line, but I do... (8 Replies)
Hi,
i have written a script. it collects data based on the sql queries executed by it. i have multiple output files. after the output file is made i need to do some cosmetic changes in the files and then store them. i am unable to use sed conditions inside the loop.
see below code for... (3 Replies)
Hi all,
I'm trying to search for the first field in a file called vintella.sudoers_1 and then use the result to grep for its match in vintella.sudoers_useralias file but assigning the second field of what it finds to another variable called to_replace.
I then want to use that to_replace... (9 Replies)
Hello
I have a group of files
a1.profile a2.profile a3.profile a4.profile b1.profile b2.profile b3.profile b4.profile These files all have the same first line with a value s1 atop the columns
s1_context s1_ref s1_sample s1_% etc I am trying to use sed in a for loop to replace the s1 in the... (2 Replies)
Discussion started by: plumb_r
2 Replies
LEARN ABOUT DEBIAN
ogamesim
ogamesim(6) Games Manual ogamesim(6)NAME
Console Ogame Simulator
SYNOPSYS
ogamesim [ -i <task.txt> ] [ -o <result.txt> ]
DESCRIPTION
Tasks for simulation are consist of text files.
Example of task concluding all possible units is adduced bellow.
OPTIONS -i <input file>: task file (STDIN unless defined);
-o <output file>: result file (STDOUT unless defined);
-s <iterations count>: 1 <= value <= N (no limits);
-t <max simulation time>: (seconds) 0 <= value <= N, 0=no limits;
-f <forks count>: 0 <= value <= 100.
RETURN VALUES
0: if success
EXAMPLES
Task concluding all possible units:
attacker
attack = 9
shield = 10
armory = 11
Small Cargo = 10
Large Cargo = 10
Light Fighter = 20
Heavy Fighter = 30
Cruiser = 40
Battleship = 50
Colony Ship = 60
Recycler = 70
Espionage Probe = 80
Bomber = 900
Destroyer = 110
Deathstar = 120
defender
attack = 11
shield = 12
armory = 13
Rocket Launcher = 100
Light Laser = 200
Heavy Laser = 300
Gauss Cannon = 400
Ion Cannon = 500
Plasma Turret = 600
Small Shield Dome = 1
Large Shield Dome = 1
Solar Satellite = 100
metal = 123456
crystal = 56789
deut = 987654
ogamesim Dec 4, 2006 ogamesim(6)