Sponsored Content
Full Discussion: Formating in Echo?
Top Forums UNIX for Dummies Questions & Answers Formating in Echo? Post 68113 by zazzybob on Thursday 31st of March 2005 06:04:24 AM
Old 03-31-2005
Changing the formatting slightly so that things "fit"....

Try
Code:
#!/bin/ksh
value1=1203
value2=asjd238432u23rj
value3=foo
fmt='%-6s %-20s %-9s \n'
{
  printf "$fmt" "Field1" "Field2" "Field3"
  printf "$fmt" "------" "------" "------"
  printf "$fmt" "$value1" "$value2" "$value3"
} > myfile

Does this produce acceptable output?

Cheers
ZB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formating output

I have a file proc.txt which contains the below one. Content-type: text/html <H2>No query</H2> infodba-marabou:/tmp => export QUERY_STRING="IMAN_server_report=full" infodba-marabou:/tmp => $IMAN_ROOT/web/htdocs/cgi-bin/iman > /tmp/proc.txt infodba-marabou:/tmp => cat proc.txt... (20 Replies)
Discussion started by: Krrishv
20 Replies

2. Shell Programming and Scripting

Output formating

Dear All I am stuck in one problem. Kindly help me. I am taking below mention file as input file and want some op file as mention below. Kindly send me all possible suggestion and query. Thnaks Jaydeep bELOW IS THE INPUT FILE: *** Connected to BSCANGR ***... (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies

3. Shell Programming and Scripting

formating output

Hi all, I want to start a new topic on this matter I have this script, #!perl use strict; use warnings; use Data::Dumper; open my $log, '>', 'log-external.txt' or die "Could not open log: $!"; print $log "Subnet,Static,DHCP,Unused\n"; open my $dump, '>', 'dump.log' or die... (2 Replies)
Discussion started by: richsark
2 Replies

4. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

5. Shell Programming and Scripting

Text formating

Dear all I had input file as mention below and want op as mention. Kindly let me knw possible ways. Regards Jaydeep INPUT: RXOTX-48-1 2A 34 2B 35 RXOTX-499-2 2C 32 RXOTX-4-1 2D 23 OUTPUT: (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

6. Shell Programming and Scripting

Formating output

Hello Team i have a file with following data (as columns). I need implement a syntax like below for altering table ALTER TABLE1 TABLENAME ADD COLUMN COL1 CHAR(5) NOT NULL WITH DEFAULT ADD COLUMN COL2 CHAR(5) .. .. ADD COLUMN COLn CHAR(5) NOT NULL... (1 Reply)
Discussion started by: rocking77
1 Replies

7. UNIX for Dummies Questions & Answers

Help with formating when using mailx

Hi I am a newbie here. I tried searching for the solution but I guess I either didn't find it or there hasn't been one posted. my problem is I spooled the results of a query into a .txt file. When I cat the file the formating looks great. All the columns are aligned. However once I mailx the... (2 Replies)
Discussion started by: RB26DETT
2 Replies

8. Shell Programming and Scripting

Formating questions

Hi, I have a data as follows in some files, i want to change CHAR(2-20) to VARCHAR(2-20). I should not touch any line with CHAR(1) Example: Input: cur_rev_stage_cd CHAR(5) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL, prev_rev_stage_cd CHAR(5) CHARACTER SET LATIN NOT... (7 Replies)
Discussion started by: srikanth38
7 Replies

9. UNIX for Beginners Questions & Answers

File formating help

Hi all, I am having the file below I need that as below Thanks, Arun (12 Replies)
Discussion started by: arunkumar_mca
12 Replies

10. Shell Programming and Scripting

File formating

I need to create a fixed width file based on the column lengths. lets assume I have six(this may be dynamic) fields each are of different length column1=6 #size of the column column2=3 column3=2 column4=3 column5=4 column6=5 I tried below code snippet but it is not working echo... (4 Replies)
Discussion started by: gvkumar25
4 Replies
DATEFMT_GET_ERROR_CODE(3)						 1						 DATEFMT_GET_ERROR_CODE(3)

IntlDateFormatter::getErrorCode - Get the error code from last operation

	Object oriented style

SYNOPSIS
public int IntlDateFormatter::getErrorCode (void ) DESCRIPTION
Procedural style int datefmt_get_error_code (IntlDateFormatter $fmt) Get the error code from last operation. Returns error code from the last number formatting operation. PARAMETERS
o $fmt - The formatter resource. RETURN VALUES
The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. EXAMPLES
Example #1 datefmt_get_error_code(3) example <?php $fmt = datefmt_create( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); $str = datefmt_format($fmt); if (!$str) { printf( "ERROR: %s (%d) ", datefmt_get_error_message($fmt), datefmt_get_error_code($fmt) ); } ?> Example #2 OO example <?php $fmt = new IntlDateFormatter( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); $str = $fmt->format(); if (!$str) { printf( "ERROR: %s (%d) ", $fmt->getErrorMessage(), $fmt->getErrorCode() ); } ?> The above example will output: ERROR: U_ZERO_ERROR (0) SEE ALSO
datefmt_get_error_message(3), intl_get_error_code(3), intl_is_failure(3). PHP Documentation Group DATEFMT_GET_ERROR_CODE(3)
All times are GMT -4. The time now is 05:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy