Alright. The
deletes the content in the file
appends it.
I changed > to >>
now i got this :
screenshot in attachments.
Something wrong in the tabling script?
What am i missing.
So it looks like you're getting all of your output (although the sample in your assignment showed two lines of headings and your output only shows one). It looks like your code to convert Centigrade to Fahrenheit is working correctly. So, what problem do you have left besides centering your output values under the appropriate headings? (You do realize that since the output values you've calculated vary from one to four characters, you will need to vary the number of spaces or tabs printed in front of the calculated values to center them, don't you?) I assume that you don't have access to the tabs utility yet, so you're probably better off just using spaces in your output rather than tabs. (And even if you do have access to the tabs utility, I wouldn't recommend using it for something like this.)
Do you know how to get bash to tell you how many characters are stored in a variable? Do you know what output column is at the center of each of your headings? With these two pieces of information, can you calculate how many leading spaces or tabs you need to print before the Centigrade value? (I'm not asking if you can do these calculations using bash; I'm asking if you understand the arithmetic required to determine how to center the strings you'll be printing.)
Do you know how to do integer arithmetic operations inside bash (without invoking bc or expr) yet? If not, it isn't a big deal, you have shown that you can use bc to perform any calculations you need to perform; it is just easier to use the bash built-in arithmetic evaluation tools. Do you know how to use a for loop in bash? Do you know how to use echo to output some characters without a trailing newline?
PS When posting code and sample input and output, please don't do anything special with the fonts. Using arial (a variable width font) instead of the default constant width font will make it almost impossible to get things lined up here.
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
Hi All,
I am hoping someone can help me with some scripting I need to complete using AWK.
I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format.
The Input file is:-
aaaa bbbbb ccccc 1 xxxx aaa bbb
aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Hi All,
I have two input file and need to generate a CSV file. The existing report just "GREP" the records with the Header and Tailer records with the count of records.
Now i need to split the data into 25 records each in the same CSV file.
id_file (Input file )
227050994
232510151... (4 Replies)
This is my input file like this
03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/
49,+00000000000416920,00002/
03,5313236,,015,+00231036992,,,045,+00231036992,,,901,+00000048428,,/
88,100,+0000000000000,0000000,,400,+0000000000000,0000000,/
88,902,+0000000079077,,/... (0 Replies)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
I've got a file that looks like this (spaces before first entries intentional):
12345650-000005000GL140227 ANNUAL HELC FEE EN
22345650-000005000GL140227 ANNUAL HELC FEE EN
32345650-000005000GL140227 ANNUAL HELC FEE EN
I want to read through the file line by line,... (6 Replies)
The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format:
input
chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18
chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.
I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice.
Files:... (3 Replies)
Experts,
Need your help for this. Please support
My motive is to create seperate output file for each Input Files(File 1 and File2) in another folder say(/tmp/finaloutput)
Input files
File 1(1.1.1.1.csv)
a,b,c
43,17104773,3
45,17104234,4
File 2(2.2.2.2.csv)
a,b,c
43,17104773,1... (2 Replies)
Discussion started by: as7951
2 Replies
LEARN ABOUT HPUX
newform
newform(1) General Commands Manual newform(1)NAME
newform - change or reformat a text file
SYNOPSIS
[file]...
DESCRIPTION
reads lines from the named files, or standard input if no input file is named, and reproduces the lines on standard output. Lines are
reformatted in accordance with command line options in effect.
Command line options can appear in any order, can be repeated, and can be intermingled with the optional files. Command line options are
processed in the order specified. This means that option sequences such as yield results different from Options are applied to all files
on the command line.
Options
recognizes the following options:
Same as except characters are appended to the end of a line.
Truncate n characters from the beginning of the line when the line length is greater than the effective line length (see The
default is to truncate the number of characters necessary to obtain the effective line length. The default value is
used when with no n is used. This option can be used to delete the sequence numbers from a COBOL program as follows:
The must be used to set the effective line length shorter than any existing line in the file so that the option is
activated.
Change the prefix/append character to
k. The default character for k is a space.
Same as except that characters are truncated from the end of the line.
Write the tab specification format line on the standard output
before any other lines are output. The tab specification format line which is printed will correspond to the format
specified in the option. If no option is specified, the line which is printed contains the default specification of
Input tab specification:
expands tabs to spaces, according to the tab specifications given. The tabspec recognizes all tab specification
forms described in tabs(1). In addition, tabspec can be in which assumes that the tab specification is to be found
in the first line read from the standard input (see fspec(4)). If no tabspec is given, tabspec defaults to A tabspec
of expects no tabs; if any are found, they are treated as
Set the effective line length to
n characters. If n is not entered, defaults to 72. The default line length without the option is 80 characters.
Note that tabs and backspaces are treated as single characters (use to expand tabs to spaces).
Output tab specification:
replaces spaces with tabs, according to the tab specifications given. The tab specifications are the same as for If
no tabspec is given, tabspec defaults to A tabspec of means that no spaces will be converted to tabs on output.
Prefix n characters (see to the beginning of a line when the line length is less than the effective line length. The
default is to prefix the number of characters necessary to obtain the effective line length.
Shear off leading characters on each line up to the first tab and
place up to 8 of the sheared characters at the end of the line. If more than 8 characters (not counting the first
tab) are sheared, the eighth character is replaced by a and any characters to the right of it are discarded. The
first tab is always discarded.
An error message and program exit occur if this option is used on a file without a tab on each line. The characters
sheared off are saved internally until all other options specified are applied to that line. The characters are then
added at the end of the processed line.
For example, to convert a file with leading digits, one or more tabs, and text on each line, to a file beginning with
the text, all tabs after the first expanded to spaces, padded with spaces out to column 72 (or truncated to column
72), and the leading digits placed starting at column 73, the command would be:
RETURN VALUE
returns one of the following values:
No errors encountered.
An error occurred.
DIAGNOSTICS
All diagnostics are fatal.
was called with a bad option.
There was no tab on one line.
Self-explanatory.
A line exceeds 512 characters
after being expanded in the internal work buffer.
A tab specification is incorrectly formatted,
or specified tab stops are not ascending.
A tabspec read from a file (or standard input) must not contain a tabspec referencing another file (or standard input).
WARNINGS
normally only keeps track of physical characters; however, for the and options, keeps track of backspaces in order to line up tabs in the
appropriate logical columns.
does not prompt the user if a tabspec is to be read from the standard input (by use of or
If the option is used, and the last option specified was and was preceded by either a or a the tab specification format line will be incor-
rect.
SEE ALSO csplit(1), tabs(1), fspec(4).
newform(1)