Sponsored Content
Top Forums Shell Programming and Scripting Help required in printing in specific format Post 302962575 by shash on Wednesday 16th of December 2015 11:58:11 AM
Old 12-16-2015
Many thanks Yoda & RudiC. Both your solutions worked!

---------- Post updated at 11:58 AM ---------- Previous update was at 04:04 AM ----------

Hi RudiC,

Is there a way to have thousand separator for numeric fields?
I tried using the following code but not able to use it in the code you provided
Code:
printf "%'.2f\n" 000001182401644.77

Can you please help?

Thanks
Shash
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help required on printing the line if third field is not a empty space

Hi Experts, I want to print the lines whose third field in non-empty/blank space. i.e. INPUT FILE/B] dcdccghjrry0yd cont dcdccttrk820529 cont rdekedfsSCr dcdccttrdky2d0y cont rdekedfsSC2 ... (3 Replies)
Discussion started by: krao
3 Replies

2. Shell Programming and Scripting

Help required on grep command(Skip the first few lines from printing in the output)

Hi experts I want the proper argument to the grep command so that I need to skip the first few lines(say first 10 lines) and print all the remaining instances of the grep output. I tried to use grep -m 10 "search text" file*. But this gives the first 10 instances(lines) of the search string.... (7 Replies)
Discussion started by: ks_reddy
7 Replies

3. UNIX for Dummies Questions & Answers

Help required on Printing of Numbers, which are missing in the range

Hi Experts, Need help on printing of numbers, which are missing in the range. Pls find the details below Input 1000000002 1000000007 1234007940 1234007946 Output 1000000003 1000000004 1000000005 1000000006 1234007941 (2 Replies)
Discussion started by: krao
2 Replies

4. Shell Programming and Scripting

Assigning a specific format to a specific column in a text file using awk and printf

Hi, I have the following text file: 8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm 9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm 10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm 11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies

5. Shell Programming and Scripting

Concatenating two files in required format

Firstly one of my mysql queries will yeild following output +-------+---------------------+-------------------+----------------------------------------------------------------------------+ | ID | PLATFORM | SORT_NAME | DESCRIPTION ... (2 Replies)
Discussion started by: vivek d r
2 Replies

6. UNIX for Dummies Questions & Answers

Printing lines with specific strings at specific columns

Hi I have a file which is tab-delimited. Now, I'd like to print the lines which have "chr6" string in both first and second columns. Could anybody help? (3 Replies)
Discussion started by: a_bahreini
3 Replies

7. Shell Programming and Scripting

Need help to format one txt file to required format

Hello Everyone, I have one source file which is genarated by SAP in different format(Which I've never seen). I need to convert that file to required format and I need to read this target file from Datastage to use this in my Jobs. So I do not have any other options except to use Unix script to... (4 Replies)
Discussion started by: Prathyu
4 Replies

8. Shell Programming and Scripting

Searching and printing only required pattern

Hi all, i am trying to count the number of logical processors from the below output: # print_manifest | grep "logical processors" 8 cores, 16 logical processors per socket 2 logical processors (2 per socket) i just want to have below output : 16 2 also... (11 Replies)
Discussion started by: omkar.jadhav
11 Replies

9. UNIX for Dummies Questions & Answers

Printing files in a specific format

Hi, I have following files in a directory with '.meta' extension, which have data in follwoing patterns. i need to print data from these files in below metioned format. please provide a script for this solution. file names: TEST_HISTORY_MTH.meta AB_TEST_1.meta cat... (2 Replies)
Discussion started by: AAHinka
2 Replies

10. Shell Programming and Scripting

Echo not printing the variables with delimiters as required

This is the file which contains only neccessary values from the output of curl command i.e TEMP_FILE Proxy Hostname server0123.domain.com Proxy IP address XXX.XXX.XX.XX port 0000 Proxy Version SGOS X.X.X.X Proxy Serial # ... (5 Replies)
Discussion started by: ramprabhum
5 Replies
dpkg-query(1)							    dpkg suite							     dpkg-query(1)

NAME
dpkg-query - a tool to query the dpkg database SYNOPSIS
dpkg-query [option...] command DESCRIPTION
dpkg-query is a tool to show information about packages listed in the dpkg database. COMMANDS
-l, --list [package-name-pattern...] List packages matching given pattern. If no package-name-pattern is given, list all packages in /var/lib/dpkg/status, excluding the ones marked as not-installed (i.e. those which have been previously purged). Normal shell wildchars are allowed in package-name-pat- tern. Please note you will probably have to quote package-name-pattern to prevent the shell from performing filename expansion. For example this will list all package names starting with "libc6": dpkg-query -l 'libc6*' The first three columns of the output show the desired action, the package status, and errors, in that order. Desired action: u = Unknown i = Install h = Hold r = Remove p = Purge Package status: n = Not-installed c = Config-files H = Half-installed U = Unpacked F = Half-configured W = Triggers-awaiting t = Triggers-pending i = Installed Error flags: <empty> = (none) R = Reinst-required An uppercase status or error letter indicates the package is likely to cause severe problems. Please refer to dpkg(1) for informa- tion about the above states and flags. The output format of this option is not configurable, but varies automatically to fit the terminal width. It is intended for human readers, and is not easily machine-readable. See -W (--show) and --showformat for a way to configure the output format. -W, --show [package-name-pattern...] Just like the --list option this will list all packages matching the given pattern. However the output can be customized using the --showformat option. The default output format gives one line per matching package, each line having the name (extended with the architecture qualifier for foreign architecture packages) and installed version of the package, separated by a tab. -s, --status package-name... Report status of specified package. This just displays the entry in the installed package status database. -L, --listfiles package-name... List files installed to your system from package-name. However, note that files created by package-specific installation-scripts are not listed. -c, --control-path package-name [control-file] List paths for control files installed to your system from package-name. If control-file is specified then only list the path for that control file if it is present. Warning: this command is semi-public, it should be used only as a last resort solution, and if no other interface is available. It might get deprecated later on if better interfaces or the current architectural deficiencies have been solved. -S, --search filename-search-pattern... Search for a filename from installed packages. All standard shell wildchars can be used in the pattern. This command will not list extra files created by maintainer scripts, nor will it list alternatives. -p, --print-avail package-name... Display details about package-name, as found in /var/lib/dpkg/available. Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect. -h, --help Show the usage message and exit. --version Show the version and exit. OPTIONS
--admindir=dir Change the location of the dpkg database. The default location is /var/lib/dpkg. -f, --showformat=format This option is used to specify the format of the output --show will produce. The format is a string that will be output for each package listed. In the format string, "" introduces escapes: newline carriage return tab "" before any other character suppresses any special meaning of the following character, which is useful for "" and "$". Package information can be included by inserting variable references to package fields using the syntax "${field[;width]}". Fields are printed right-aligned unless the width is negative in which case left alignment will be used. The following fields are recog- nised but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it): Architecture Bugs Conffiles (internal) Config-Version (internal) Conflicts Breaks Depends Description Enhances Essential Filename (internal, dselect related) Homepage Installed-Size MD5sum (internal, dselect related) MSDOS-Filename (internal, dselect related) Maintainer Origin Package PackageSpec (virtual field) Pre-Depends Priority Provides Recommends Replaces Revision (obsolete) Section Size (internal, dselect related) Source Status (internal) Suggests Tag (usually not in the .deb but in APT's Packages files) Triggers-Awaited (internal) Triggers-Pending (internal) Version The default format string is "${PackageSpec} ${Version} ". Actually, all other fields found in the status file (i.e. user defined fields) can be requested, too. They will be printed as-is, though, no conversion nor error checking is done on them. PackageSpec is a special field that will print the package name with an architecture qualifier (like "libc6:amd64") if the package is of a foreign architecture (an architecture that doesn't match dpkg's architecture). To get the name of the dpkg maintainer and the installed version, you could run: dpkg-query -W -f='${PackageSpec} ${Version} ${Maintainer} ' dpkg EXIT STATUS
0 The requested query was successfully performed. 1 Problems were encountered while parsing the command line or performing the query, including no file or package being found (except for --control-path). ENVIRONMENT
DPKG_ADMINDIR If set and the --admindir option has not been specified, it will be used as the dpkg data directory. COLUMNS This setting influences the output of the --list option by changing the width of its output. AUTHOR
Copyright (C) 2001 Wichert Akkerman This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY. SEE ALSO
dpkg(1). Debian Project 2010-03-07 dpkg-query(1)
All times are GMT -4. The time now is 07:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy