i have a file datafine.log in this file there is :
i want to insert the value of datafine.log in a variable.
First, you should notice that funny things ca happen if the content of the file is more than the (probably expected) one line of text. Some caution is advised before you use data in this way therefore.
Aside from these considerations it is quite easy:
$( .... ) is a subshell which runs the commands inside the brackets and puts it output on the line, similar to a variable expansion. The command < /path/to/file is a simple redirection which means the output is the content of the file.
i want to insert a variable in the last column of a file, the columns are separated by "|". I want to insert the variable in everyline of the file . (7 Replies)
I have tried
sed '/6/a text_to_inserted' file > newfile
but this inserts test_to_insert at random places in file and i want it in specific location, which is line 6.
can anyone help.... (6 Replies)
Hi all, I am trying to insert couple of lines before first occurance of line3 which occuring after line 5.
So I identified the line 5 line number in the file. Also redirected the all line3 line number to out.txt.
Now I have problem in inserting the line using the variable $rep. Please help me... (2 Replies)
Hey guys ,
i have a variable with the contents ...
NUMBER=4
and a test file with the contents
1248
1213
1214
1278
1200
3045
3444
2130
I want to execute a script that will produce the following output ( based on NUMBER=4) to be ...
create 1248 (1 Reply)
Hi, I want to insert one file into another like this:
file 1:
1
2
3
<!-- #include file="file2" -->
4
5
<!-- #include file="file3" -->
6
with the complete output going to another file. Have seen some solutions to similar problems using sed, but this problem is different because it is... (5 Replies)
Hi I need a bash script that can search through a text file and when it finds 'FSS1206' I need to put a Letter F 100 spaces after the second instance of FSS1206
The format is the same throughout the file I need to repeat this on every time it finds the second 'FSS1206' in the file
I have... (0 Replies)
Hello,
I have the following variables set in my env
echo $MY_XSD_FILE
/home/jak/sample.xsd
echo $MY_INTERVAL_VALUE
4
I want to insert them between the xml tags in my xml file
cat sample.xml
:::::::::::::::
:::::::::::::::
<property name="FILE"></property>
:::::::::::::::::::::::... (2 Replies)
Hi, I'm looking to accomplish the following.
Insert current date into three places/cells within a cvs, every time the bash script is executed.
The cells are column A,B,C row 2. Row 1 is reserved for the headers.
The file name is always orders.csv. These three cells we always have an old... (1 Reply)
I have multiple xml files where i want to update a subnode if the subnode project points to different project or insert a subnode if it doesn't exist using a xmlstarlet or any other command that can be used in a bash script.
I have been able to update the subnode project if it doesn't point to... (1 Reply)
I currently have a loop that reads all .bam files in a directory (wont always be 4 like in this example,
into $id. What I am trying to do, unsucessfully, is create specific new lines in an exsisting command using
each $id. Each new line would be:
--bam ${id} \
Tried
p=$dir... (8 Replies)