Get a value from a file and insert it in a different file
I have a file that contains attribute values, for example, name.out has
I also have a template file for each of name values. I have already created all the files for each name, for sample,
Each of the ldif file has an entry like
I will need to read the names from the name.out file, and replace dummy name FFFFF with the actual name. At the completion, I should have add.Alice.ldif contains Name=Alice, add.Bob.ldif contains Name=Bob.
So I created the following sh file.
When I run the sh file, the names are displayed correctly on the screen, however, they are not written to the ldif files correctly. The ldif files has
I probably have missed something. How can I fix it? Thanks.
Thank you. Double quotes solved the problem. read -p "Press [Enter] key to continue..." doesn't work. It does not pause the script and wait for me to enter the "Enter" key to continue.
Not sure why read command is not working for you. It works fine for me. Is it necessary that the script should wait for you to hit enter key every time [in each loop]?
I tried the second option and it works (haven't tried the first one). I don't understand what
, and
mean. Is it possible for me to get some explanations? Thanks.
(I don't have to write "Enter" in this specific case, but think later I may need to expand the code to include more functions, so it is better for me to learn now.)
Hi ,
I'm looking for some code that can copy and paste form file1 to file2 with 2 criterial meet.
file1:
test "sp-j1"
test "sp-j2"
test "sp-j3"
test "sp-j4"
file2:
sub Pre_Shorts1 (Status_Code, Message$)
global Status
!if Message$ <> "" then print... (3 Replies)
Hi all,
I'm new to scripting.. facing some problems while inserting content of a file into another file...
I want to insert content of a file (file2) into file1, before first occurrence of "line starts with pattern" in file1
file1
======
working on linux
its unix world
working on... (14 Replies)
Hi friends, here is my problem.
I have three files like this..
cat file1.txt
=======
unix is best
unix is best
linux is best
unix is best
linux is best
linux is best
unix is best
unix is best
cat file2.txt
========
Windows performs better
Mac OS performs better
Windows... (4 Replies)
Hello,
I have few lines to be inserted in file_lines_to_insert.
In another file final_file, I have to add lines from above file file_lines_to_insert before a particular pattern.
e.g.
$ cat file_lines_to_insert => contents are
abc
def
lkj
In another file final_file, before a... (6 Replies)
Hi Friends,
I am writing a shell script where it is required to insert a file say file1 into file2 after certain number of fixed lines in file2..
Please help me how this could be done.. Please suggest me any useful links i need to go through to achieve this....
Thanks in advance .. (2 Replies)
Hi,
I am new to shell scripting. I need a bash shell scripts which search and grep a parameter value from input.txt file and insert it in between two semicolon of second line of output.txt file.
For example
The shell script search an IP address as parameter value from input.txt ... (2 Replies)
Hi
I found the following line would concatenate all test_01 test_02 test_03 files into "bigfile".
cat test_* >> bigfile
But, what I'm looking for a way to insert each file names in order when concatenated in "bigfile".
Thank you
samky2005 (2 Replies)
I have a file with data extracted, and need to insert a header with a constant string, say: H|PayerDataExtract
if i use sed, i have to redirect the output to a seperate file like
sed ' sed commands' ExtractDataFile.dat > ExtractDataFileWithHeader.dat
the same is true for awk
and... (10 Replies)
Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.
Write a script 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... (3 Replies)