Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Printing a file within a cat call Post 302817237 by Don Cragun on Wednesday 5th of June 2013 12:57:33 PM
Old 06-05-2013
Quote:
Originally Posted by jaldo0805
Hello,
I have a file called geom.txt which has some data in a particular format readable by another program (after adding some 'standard lines'), so what I want to do is to have a script that enables me to create a file (lets call it 'inpfile') readable for that program using a cat command, if I want to introduce the value of a previously defined variable (lets say key=345298) into 'inpfile' I simple type $key and it prints the value of the variable into the file, but how to print the content of geom.txt? This is what I have so far:
Code:
cat<<eoi>inpfile
Some standard lines of the program that is going to execute inpfile ....
$key
Content of geom.txt desired
Some other standard lines...
eoi

Thanks,
You're almost there. All you need to do is define key before you invoke cat. So for your example, all you need is:
Code:
key=345298
cat<<eoi>inpfile
Some standard lines of the program that is going to execute inpfile ....
$key
Content of geom.txt desired
Some other standard lines...
eoi

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cat and lp or pr printing of file

Can you use cat to send the first 25 lines of a file to the printer? I'm thinking I can pipe it with '|' but I'm not school to check printer output. With the 'nl' used, all lines are numbered on the print out, but how does one number only the blank lines? Thanks:) (1 Reply)
Discussion started by: bitwize
1 Replies

2. UNIX for Dummies Questions & Answers

Easiest way to cat out first 100 lines of a file into a different file?

Not sure how to do this exactly.. just want to take the first 100 lines of a file and cat it out into a second file. I know I can do a more on a file and > it into a different file, but how can I make it so only the first 100 lines get moved over? (1 Reply)
Discussion started by: LordJezo
1 Replies

3. UNIX for Dummies Questions & Answers

How to cat file

I want to cat a file with only show the line contain '/bin/bash' but don't show the line contain 'load' (don't show if the line contain 'load' and '/bin/bash' together), how to type in the command? thk a lot! (2 Replies)
Discussion started by: zp523444
2 Replies

4. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

5. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

6. Shell Programming and Scripting

Cat file

how to cat a file by ignoring first line and last line (1 Reply)
Discussion started by: thelakbe
1 Replies

7. UNIX for Advanced & Expert Users

for i in `cat file` do

in bash: for i in `cat file` ; do echo $i done; how will i do this in perl ? (10 Replies)
Discussion started by: linuxgeek
10 Replies

8. Shell Programming and Scripting

Cat Command on File not printing "Blank" Lines?

Hello All, I have a bash script and in it at some point I call an Expect Script that does some stuff and saves its output in a ".txt" file. Example "/path/to/my/file/Expect_Output.txt" file: notice the 2nd line is empty in the file... Data for Host-1 (192.168.1.110) Checking the... (2 Replies)
Discussion started by: mrm5102
2 Replies

9. Shell Programming and Scripting

Ssh cat file output into a file on local computer

Hello, I'm on a remote computer by SSH. How can I get the output of "cat file" into a file on the local computer? I cannot use scp, because it's blocked. something like: ssh root@remote_maschine "cat /file" > /locale_machine/file :rolleyes: (2 Replies)
Discussion started by: borsti007
2 Replies
XkbFreeGeomKeyAliases(3)					   XKB FUNCTIONS					  XkbFreeGeomKeyAliases(3)

NAME
XkbFreeGeomKeyAliases - Free geometry key aliases SYNOPSIS
void XkbFreeGeomKeyAliases (XkbGeometryPtr geom, int first, int count, Bool free_all); ARGUMENTS
- geom geometry in which key aliases should be freed - first first key alias to be freed - count number of key aliases to be freed - free_all True => all key aliases are freed DESCRIPTION
Xkb provides a number of functions to allocate and free subcomponents of a keyboard geometry. Use these functions to create or modify key- board geometries. Note that these functions merely allocate space for the new element(s), and it is up to you to fill in the values explicitly in your code. These allocation functions increase sz_* but never touch num_* (unless there is an allocation failure, in which case they reset both sz_* and num_* to zero). These functions return Success if they succeed, BadAlloc if they are not able to allocate space, or BadValue if a parameter is not as expected. If free_all is True, all aliases in the top level of the specified geometry geom are freed regardless of the value of first or count. Oth- erwise, count aliases in geom are freed beginning with the one specified by first. RETURN VALUES
Success The XkbFreeGeomKeyAliases function returns Success if there are no allocation errors. DIAGNOSTICS
BadAlloc Unable to allocate storage BadValue An argument is out of range X Version 11 libX11 1.3.2 XkbFreeGeomKeyAliases(3)
All times are GMT -4. The time now is 06:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy