Sponsored Content
Top Forums Shell Programming and Scripting How can I change is output format by awk ? Post 302419699 by wanchem on Saturday 8th of May 2010 03:19:26 AM
Old 05-08-2010
thank you
i try to use this command

Code:
awk -FD '{print $1}' file_name

and my output is
Code:
0.2057422
0.2463722
-0.1068047

But i want this form
Code:
0.02057422
0.02463722
-0.001068047

How can i change is form by using awk
thank you very much
wan

Last edited by Scott; 05-08-2010 at 05:03 AM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

2. Shell Programming and Scripting

Change file output format

I have a file which has following contents usmtnz-dinfsi19 62 61 18400 18800 99.7 usmtnz-dinfsi19 62 61 18400 18800 99.7 i want the o/p to be like date (7 Replies)
Discussion started by: fugitive
7 Replies

3. Shell Programming and Scripting

change the output format

when i run the following command db2 list tablespaces Tablespaces for Current Database Tablespace ID = 0 Name = SYSCATSPACE State = 0x0000 Tablespace ID ... (3 Replies)
Discussion started by: lazydev
3 Replies

4. Shell Programming and Scripting

change output format using ksh

I have a script that reaches out to several systems and pulls back infomation in serveral files. I would like to take the infomation returned and reformat it so I can export it to excel. Below is current output: File1:item1:abc=1 File1:item2:efg File2:item1:ab=1 File2:item2:efg... (3 Replies)
Discussion started by: oldman2
3 Replies

5. Shell Programming and Scripting

using awk or bash to change the format

tenxun-glibc_code-x86-64-linux-20120713190049.root.tar.bz2 To tenxun-glibc_code-x86-64-linux.root.tar.bz2 (3 Replies)
Discussion started by: yanglei_fage
3 Replies

6. Shell Programming and Scripting

Change a file content format using awk

Hi, i have a file input.txt Continent North America Country USA Capital Washington D.C. Country Canada Capital Ottawa Continent South America Country Argentina Capital Buenos Aires Country Brazil Capital Brasília Coutry Colombia Capital Bogotá and i want to get an output.txt ... (3 Replies)
Discussion started by: fastlane3000
3 Replies

7. Shell Programming and Scripting

awk - change date format

I have below date format in a CSV file. (dd/mm/yyyy) Ex Input: 9/8/2013 Need to convert it into below format (yyyymmdd ) and redirect to new file. Ex Output: 20130809 How do I use awk here to change the format and if leading 0 (zero) is not then add it. Please help. Thanks. (8 Replies)
Discussion started by: vegasluxor
8 Replies

8. UNIX for Dummies Questions & Answers

Use awk to change an IP format

Basically I am trying to run a standard output of IP address with a port number into another command but I need to change it from. 74.125.224.194.80 into 74.125.224.194:80 One command wants a period before the port the subsequent one wants a colon. So is there anyway I can feed... (3 Replies)
Discussion started by: MrEddy
3 Replies

9. Shell Programming and Scripting

Need to change date format in a csv file using awk

Example: Input csv file 00245DLS,Sitel Ocala,12/31/2014,18:45,1.00,7.00,0.00,0.00 00245DLS,Sitel Ocala,12/31/2014,19:00,-1.00,-1.00,-1.00,-1.00 00245HB,Charlotte,01/01/2015,00:00,-1.00,-1.00,-1.00,0.00 Output csv file 00245DLS,Sitel Ocala,2014/12/31,18:45,1.00,7.00,0.00,0.00 00245DLS,Sitel... (8 Replies)
Discussion started by: adit
8 Replies

10. UNIX for Beginners Questions & Answers

Date format conversion how to change this from using nawk to awk

Hi, I have a file where I need to change the date format on the nth field from DD-MM-YYYY to YYYY-MM-DD so I can accurately sort the record by dates From regex - Use sed or awk to fix date format - Stack Overflow, I found an example using nawk. Test run as below: $: cat xyz.txt A ... (2 Replies)
Discussion started by: newbie_01
2 Replies
XMLTO(1)							       xmlto								  XMLTO(1)

NAME
xmlto - apply an XSL stylesheet to an XML document SYNOPSIS
xmlto [-o output_dir] [-x custom_xsl] [-m xsl_fragment] [-v] [-p postprocessor_opts] [--extensions] [--searchpath path] [--skip-validation] {format} {file} xmlto {--help | --version} DESCRIPTION
The purpose of xmlto is to convert an XML file to the desired format using whatever means necessary. This may involve two steps: 1. The application of an appropriate XSL stylesheet using an XSL-T processor. 2. Further processing with other tools. This step may not be necessary. To decide which stylesheet to use and what, if any, needs to be done to post-process the output, xmlto makes use of format scripts, which are simple shell scripts that xmlto calls during the conversion. The appropriate format script is selected based on the type of XML file and the desired output format. xmlto comes with some format scripts for converting DocBook XML files to a variety of formats. You may specify your own format script by using an absolute filename for format on the command line. Firstly, if xmlto has not been told explicitly which stylesheet to use (with the -x option), the format script will be called with $1 set to stylesheet. The environment variable XSLT_PROCESSOR contains the base name of the executable that will be used to perform the XSL-T transformation (for example xsltproc), and the environment variable XSL_DIR contains the path to the directory containing some useful stylesheets that come with xmlto. The format script should write the name of the stylesheet to use to standard output and exit success- fully, or exit with a non-zero return code if there is no appropriate stylesheet to use (for example, if the only available stylesheet is known not to work with the XSL-T processor that will be used). If nothing is written to standard output but the script exits successfully, no XSL-T transformation will be performed. Secondly, after an XSL-T processor has been run using the stylesheet, the format script will be called again, this time with $1 set to post-process. The format script should perform any necessary steps to translate the XSL-T processed output into the desired output format, including copying the output to the desired output directory. For post-processing, the format script is run in a temporary directory con- taining just the processed output (whose name is stored in XSLT_PROCESSED and whose basename is that of the original XML file with any filename extension replaced with .proc). INPUT_FILE is set to the name of the original XML file, OUTPUT_DIR is set to the name of the directory that the output (and only the output) must end up in, and SEARCHPATH is set to a colon-separate list of fallback directories in which to look for input (for images, for example). If this step is unsuccessful the format script should exit with a non-zero return code. -v Be verbose (-vv for very verbose). -x stylesheet Use stylesheet instead of asking the format script to choose one. -m fragment Use the provided XSL fragment to modify the stylesheet. -o directory Put output in the specified directory instead of the current working directory. -p postprocessor_opts Pass postprocessor_opts to processing stages after stylesheet application (e.g. lynx or links when going through HTML to text, or xmltex when going from through TeX to DVI). If -p is specified a second time, the options specified will be passed to second-stage postprocessing; presently this is only applicable when going through xmltex and dvips to PostScript. --extensions Turn on stylesheet extensions for the tool chain in use (for example, this might turn on passivetex.extensions and use.extensions if PassiveTeX is being used). The variables turned on are the ones used by Norman Walsh's DocBook XSL stylesheets. --searchpath path Add the colon-separated list of directories in path as fallback directories for including input. --skip-validation Skip the validation step that is normally performed. --help Display a short usage message. It will describe xmlto's options, and the available output formats. --version Display the version number of xmlto. EXAMPLES
To convert a DocBook XML document to PDF, use: xmlto pdf mydoc.xml To convert a DocBook XML document to HTML and store the resulting HTML files in a separate directory use: xmlto -o html-dir html mydoc.xml To convert a DocBook XML document to a single HTML file use: xmlto html-nochunks mydoc.xml To modify the output using an XSL fragment use: xmlto -m ulink.xsl pdf mydoc.xml To specify which stylesheet to use (overriding the one that the format script would choose) use: xmlto -x mystylesheet.xsl pdf mydoc.xml AUTHOR
Tim Waugh <twaugh@redhat.com>. Linux October 2002 XMLTO(1)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy