Sponsored Content
Full Discussion: format string output
Top Forums Shell Programming and Scripting format string output Post 302471289 by anurag.singh on Friday 12th of November 2010 12:52:12 PM
Old 11-12-2010
Code:
#!/bin/ksh
IFSsav="$IFS"
IFS="XXXXXXXX"
message="this is the output of ps command\n\n
`ps -ef`\n\n
Output Complete"
echo "$message"
IFS="$IFSsav"

Here message variable will have the formated string.
OR the way Scrutinizer suggested.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ls output format

below is the output is ls -l -rw-r--r-- 1 tonyt staff 3212 Apr 17 1999 file1 -rw-r--r-- 1 tonyt staff 4541 Mar 3 21:08 file2 why the date format is not the same? (6 Replies)
Discussion started by: tonyt
6 Replies

2. Shell Programming and Scripting

capturing output from top and format output

Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date `top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03 Cpu(s): 3.4% us, 8.5% sy .. .. Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies

3. Shell Programming and Scripting

How to format output

Dear all, I have written a program which access database and displays the values returned by the query . There are 10 columns to be displayed in one row. But am ending with 5 lines displayed on 1st line and the next 5 in the 2nd line. Ex : 21608 10-20-2007 148 Al's Appliance... (7 Replies)
Discussion started by: uday542
7 Replies

4. UNIX for Advanced & Expert Users

Format the Output

Hi- Objective of the task is to print the lines which doesnt have a END statement corresponding to a START statement. Let me know if anyone has a better way of doing is. My Thoughts Have 2 files one having START lines and another having END lines (sorted). And then diff the files to get... (8 Replies)
Discussion started by: lorcan
8 Replies

5. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

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)
Discussion started by: hudson03051nh
1 Replies

6. Shell Programming and Scripting

awk: round output or delimit output of arithmatic string

I have a file with the following content. > cat /tmp/internetusage.txt 6709.296322 30000 2/7/2010 0.00I am using the following awk command to calculate a percentage from field 1 and 2 from the file. awk '{ print $1/$2*100 }' /tmp/internetusage.txt This outputs the value "22.3643" as a... (1 Reply)
Discussion started by: jelloir
1 Replies

7. Shell Programming and Scripting

Output for 'who' in particular format

echo `whoami;echo @;who -ms | cut -f 2 -d "(" | sed "s/)$//"` getting output as : <userid> @ <machinename> Is it possible to get output as : <userid>@<machinename> (9 Replies)
Discussion started by: lalitpct
9 Replies

8. Shell Programming and Scripting

FORMAT output

Input File Symmetrix ID : 000192601507 Masking View Name : TS00P22_13E_1 Last updated at : 05:10:18 AM on Tue Mar 22,2011 Initiator Group Name : 10000000c960b9cd Host Initiators { WWN : 10000000c960b9cd WWN : 10000000c960b9dd } Port... (1 Reply)
Discussion started by: greycells
1 Replies

9. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

10. Shell Programming and Scripting

Format with output

I have written some scripts that resulted in the table below (Column1 is ITEM, Column2 is Group, Column3 is Category and Column4 is Quantity) but I want the output in another format: Input: K123 X CATA 3 K123 Y CATA 4 K123 Z CATA 2 K123 X CATB 5 K123 Y CATB 2 K123 Z CATB 2 B65 M CATB... (7 Replies)
Discussion started by: aydj
7 Replies
AP(8)                                                                [nmh-1.5]                                                               AP(8)

NAME
ap - parse addresses 822-style SYNOPSIS
/usr/lib/mh/ap [-form formatfile] [-format string] [-normalize | -nonormalize] [-width columns] [-version] [-help] addrs ... DESCRIPTION
Ap is a program that parses addresses according to the ARPA Internet standard. It also understands many non-standard formats. It is use- ful for seeing how nmh will interpret an address. The ap program treats each argument as one or more addresses, and prints those addresses out in the official 822-format. Hence, it is usu- ally best to enclose each argument in quotes for the shell. To override the output format used by ap, the -format string or -format file switches are used. This permits individual fields of the address to be extracted with ease. The string is simply a format string, and the file is simply a format file. See mh-format(5) for the details. In addition to the standard escapes, ap also recognizes the following additional escape: Escape Returns Description error string A diagnostic if the parse failed If the -normalize switch is given, ap will try to track down the official hostname of the address. Here is the default format string used by ap: %<{error}%{error}: %{text}%|%(putstr(proper{text}))%> which says that if an error was detected, print the error, a `:', and the address in error. Otherwise, output the 822-proper format of the address. FILES
$HOME/.mh_profile The user profile /etc/nmh/mts.conf nmh mts configuration file PROFILE COMPONENTS
None SEE ALSO
dp(8), Standard for the Format of ARPA Internet Text Messages (RFC-822) DEFAULTS
`-format' defaults as described above `-normalize' `-width' defaults to the width of the terminal CONTEXT
None BUGS
The argument to the -format switch must be interpreted as a single token by the shell that invokes ap. Therefore, one must usually place the argument to this switch inside quotes. MH.6.8 11 June 2012 AP(8)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy