Sponsored Content
Full Discussion: Allignment
Top Forums Shell Programming and Scripting Allignment Post 302340428 by chipcmc on Monday 3rd of August 2009 10:50:28 AM
Old 08-03-2009
try this shell:

total=`wc -l $1| cut -f1 -d" " `
while read linea
do
total=`expr $total - 1`
if [ ${total} -eq 0 ] || [ ${total} -eq 1 ]
then
echo "\t$linea"
else
echo "$linea"
fi
done < $1
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Allignment of lines in a file

Hi All, I am using the below scrit to insert lines in a file: #!/bin/ksh # To delete the last line if it contains the pattern Redirect permanent / Virgin Atlantic Airways - Popup echo "Enter the URL that should point to the particular microsite" read url # To delete the last line if it... (2 Replies)
Discussion started by: Shazin
2 Replies

2. Shell Programming and Scripting

linux 'paste' allignment problem

Hi Everyone, # cat 1 #!/usr/bin/perl print "c\tc\t\n"; # cat 2 #!/usr/bin/perl print "b\tb\t\n"; print "b\tb\t\n"; print "b\tb\t\n"; # perl 1 > 11 # perl 2 > 22 # cat 11 c c # cat 22 b b b b b b # paste 11 22 (5 Replies)
Discussion started by: jimmy_y
5 Replies

3. Shell Programming and Scripting

Text allignment using PERL

Hi Friends, For daily reports i make perl script like below. @dirlist = `cat out.txt |cut -d "|" -f1 >create.txt`; @dirlist1 = `cat out.txt|wc -l *e* >create2.txt`; open FILE, ">OUTPUT.txt"; @command = `cat out.txt |cut -d "|" -f1`; print FILE map{$_-2 ."\n"}@command; @dirlist2 =... (1 Reply)
Discussion started by: adaleru
1 Replies

4. Shell Programming and Scripting

Output allignment

Hi Guys, I hope you are doing good out there. I am facing some issues in the alligment of the output of a shell script. Below is the statement which is formatting the output:echo $File | awk -F '' '{print $13,$15="\t"$16,$4="",$5,$6,$7}' and its output is Domain Log file ... (2 Replies)
Discussion started by: singh.chandan18
2 Replies

5. Shell Programming and Scripting

awk - script help: column to row format of data allignment?

Experts Good day, I have the following data, file1 BRAAGRP1 A2X B2X C2X D2X BRBGRP12 A3X B3X Z10 D09 BRC1GRP2 LO01 (4 Replies)
Discussion started by: rveri
4 Replies

6. Shell Programming and Scripting

Allignment input file

Guys, I have a requirement as below 36%/ 55%/var 82%/tmp 74%/opt now i want the output to be --------------------------------- Disk% Mount --------------------------------- 36% / 55% var 82% tmp 74% opt ---------------------------------------- I have used... (3 Replies)
Discussion started by: AraR87
3 Replies
acctcms(1M)						  System Administration Commands					       acctcms(1M)

NAME
acctcms - command summary from process accounting records SYNOPSIS
/usr/lib/acct/acctcms [ -a [-o] [-p]] [-c] [-j] [-n] [-s] [-t] filename... DESCRIPTION
acctcms reads one or more filenames, normally in the form described in acct.h(3HEAD). It adds all records for processes that executed iden- tically named commands, sorts them, and writes them to the standard output, normally using an internal summary format. OPTIONS
-a Print output in ASCII rather than in the internal summary format. The output includes command name, number of times executed, total kcore-minutes, total CPU minutes, total real minutes, mean size (in K), mean CPU minutes per invocation, "hog factor," char- acters transferred, and blocks read and written, as in acctcom(1). Output is normally sorted by total kcore-minutes. Use the following options only with the -a option: -o Output a (non-prime) offshift-time-only command summary. -p Output a prime-time-only command summary. When -o and -p are used together, a combination prime-time and non-prime-time report is produced. All the output summaries are total usage except number of times executed, CPU minutes, and real minutes, which are split into prime and non-prime. -c Sort by total CPU time, rather than total kcore-minutes. -j Combine all commands invoked only once under "***other". -n Sort by number of command invocations. -s Any file names encountered hereafter are already in internal summary format. -t Process all records as total accounting records. The default internal summary format splits each field into prime and non-prime- time parts. This option combines the prime and non-prime time parts into a single field that is the total of both, and provides upward compatibility with old style acctcms internal summary format records. EXAMPLES
Example 1: Using the acctcms command. A typical sequence for performing daily command accounting and for maintaining a running total is: example% acctcms filename ... > today example% cp total previoustotal example% acctcms -s today previoustotal > total example% acctcms -a -s today ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWaccu | +-----------------------------+-----------------------------+ SEE ALSO
acctcom(1), acct(1M), acctcon(1M), acctmerg(1M), acctprc(1M), acctsh(1M), fwtmp(1M), runacct(1M), acct(2), acct.h(3HEAD), utmpx(4), attributes(5) NOTES
Unpredictable output results if -t is used on new style internal summary format files, or if it is not used with old style internal summary format files. SunOS 5.10 22 Feb 1999 acctcms(1M)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy