Sponsored Content
Top Forums Shell Programming and Scripting How to get content of a variable into text file (sed)? Post 302401538 by durden_tyler on Saturday 6th of March 2010 05:11:18 PM
Old 03-06-2010
Not sure about the sed thing, but if you are okay with alternative solutions, then -

Code:
$ 
$ cat file.nfo
test23423
test 234
test3443
whole lot of text
$ 
$ cat file.txt
[nfo]nfotxt[/nfo]
$ 
$ perl -pi.bak -e "s/nfotxt/`cat file.nfo`/" file.txt
$ 
$ cat file.txt
[nfo]test23423
test 234
test3443
whole lot of text[/nfo]
$ 
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

redirecting variable content to a file!

Hello! I'm having problems trying to extract the contents of a variable and placing it into a text file. Grateful for any help. Been trying something along the lines of: $variable > file.txt or `cat < $variable` > file.txt As you can see I'm a newbie to this :D (2 Replies)
Discussion started by: lloowen
2 Replies

2. Shell Programming and Scripting

Inserting text to file, sed and variable not acting right

I want to put text stored in a variable into a file on the 7th line. I'm having trouble with this line: sed '7i\'$text'' $file It works perfectly for a single word, but fails if there are two words because of the space. I've tried several forms of quoting and this is the only one that... (2 Replies)
Discussion started by: fubaya
2 Replies

3. Shell Programming and Scripting

Variable of Content From Part of Other File

I may not being doing this description justice, but I'll give it a try. I created a mailx script; there will be several messages using the same script where the only difference is the content. So I figured I'd make the content of the message a variable retrieved from a separate file. I have five... (5 Replies)
Discussion started by: royarellano
5 Replies

4. Shell Programming and Scripting

how to get the specified content of the text into a variable.

I am having one string like ./usr1/Server/temp/app.env ./usr1/Server/temp/upp/app.env ./usr1/Server/ORIG_temp/app.env ./usr1/Server/ORIG_temp/upp/app.env ./usr1/Server/work_temp_40/app.env ./usr1/Server/work_temp_40/upp/app.env ./usr1/fd/app.env ./usr1/PurgeArchive/app.env ./usr1/bm/bin/app.env... (6 Replies)
Discussion started by: dineshmurs
6 Replies

5. Shell Programming and Scripting

How to put content of file into a variable?

For example, I have a simple text file note: this a note a simple note a very very simple notewhen I use this command, temp=$(cat "note.txt")then I echo temp, the result is in one line. echo $temp note: this a note a simple note a very very simple noteMy variable doesn't have newline. How... (7 Replies)
Discussion started by: 14th
7 Replies

6. Shell Programming and Scripting

Script to create a text file whose content is the text of another files

Hello everyone, I work under Ubuntu 11.10 (c-shell) I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment. I will show you an example: - On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Discussion started by: tenteyu
1 Replies

7. Shell Programming and Scripting

Sed: replace content from file with the content from file

Hi, I am having trouble while using 'sed' with reading files. Please help. I have 3 files. File A, file B and file C. I want to find content of file B in file A and replace it by content in file C. Thanks a lot!! Here is a sample of my question. e.g. (file A: a.txt; file B: b.txt; file... (3 Replies)
Discussion started by: dirkaulo
3 Replies

8. Shell Programming and Scripting

Variable resolution in File content

I have a file File1 containing lines like below apple ${FRUIT}-Color orange ${FRUIT}-Color banana ${FRUIT}-Color Now, in my shell I'm reading the file like below while read FRUIT DESC; do echo $FRUIT $DESC; done < File1 which outputs - apple ${FRUIT}-Color orange ${FRUIT}-Color... (3 Replies)
Discussion started by: nexional
3 Replies

9. UNIX for Dummies Questions & Answers

Getting ls content into a file using variable

hi i just cant figure out how can i do this ls -lt > log.txt using $PWD what i mean is how can i get the ls command content into a file using $PWD variable? :confused: (4 Replies)
Discussion started by: chinababy
4 Replies

10. Shell Programming and Scripting

Replacement of variable by their content in a file

Dear all, I have a "SQL request" in a file: that request include different "host variable" and I would like to substitute the different "host variable" by their respective content before executing the request. For example: $ echo $SHELL /bin/bash $ cat dae2.txt DELETE FROM ... (11 Replies)
Discussion started by: dae
11 Replies
NMLC(1) 						    BSD General Commands Manual 						   NMLC(1)

NAME
NMLC -- A compiler from NML code to NFO and/or GRF files. SYNOPSIS
nmlc [options] [file] OPTIONS
-c Crop extraneous transparent blue from real sprites. -u Save real sprites uncompressed to GRF files. This saves a lot of time during encoding but it's not recommended when creating a file for distribution since it makes the output file substantially bigger. --grf=file Write output in GRF format to <file>. --nfo=file Write output in NFO format to <file>. --nml=file Write output in NML format to <file>. --output=file | -o file Write output to <file>. The output type is detected from the extension of the filename. It must be one of nfo, nml or grf. --debug | -d Print a dump of the AST to stdout. --help | -h Print usage information. --stack | -s Dump stack when an error occurs --custom-tags=file | -t file Load custom tags from <file> [default: custom_tags.txt] --lang-dir=dir | -l dir Load language files from directory <dir> [default: lang] --default-lang=file The default language is stored in <file> [default: english.lng] --sprites-dir=dir | -a dir Store 32bpp sprites in directory <dir> [default: sprites] --start-sprite=file Set the first sprite number to write (do not use except when you output nfo that you want to include in other files). --palette=palette | -p palette Force nml to use the palette <pal> [default: ANY]. Valid values are 'DOS', 'WIN', 'ANY'. SEE ALSO
The language reference at http://hg.openttdcoop.org/nml/raw-file/tip/docs/index.html AUTHOR
NML was written by Albert Hofkamp, Jasper Reichardt, Ingo von Borstel, Jose Soler and Thijs Marinussen. This manual page was written by Thijs Marinussen. June 18, 2011
All times are GMT -4. The time now is 06:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy