Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to print arguments in reverse order? Post 302510176 by vgersh99 on Friday 1st of April 2011 05:25:28 PM
Old 04-01-2011
Code:
#!/bin/ksh

n=$(($#+1))
while ((n=n-1))
do
  echo $n
done


Last edited by vgersh99; 04-01-2011 at 06:31 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sort a file in reverse order

I a file with log entries... I want to sort it so that the last line in the file is first and the first line is last.. eg. Sample file 1 h a f 8 6 After sort should look like 6 8 f a h 1 (11 Replies)
Discussion started by: frustrated1
11 Replies

2. UNIX for Dummies Questions & Answers

sort -reverse order

I need to sort the particular column only in reverse order how i can give it.. if i give the -r option the whole file is getting sorted in reverse order. 1st 2nd col 3rd C col 4th col 5th col ------------------------------------------- C... (7 Replies)
Discussion started by: sivakumar.rj
7 Replies

3. Shell Programming and Scripting

cut a field, but with reverse order

Hi Everyone, I have one a.txt: a b 001 c b b 002 c c c, not 002 c The output should be 001 002 002 If i use cut -f 3 -d' ', this does not work on the 3rd line, so i thought is any way to cut the field counting from the end? or any perl thing can do this?:confused: ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

4. Shell Programming and Scripting

Print rows in reverse order if values decrease along the column

Hi, Guys. Please help me to find solution to this problem using shell scripting. I have an INPUT file with 4 columns separated by tab. Each block of records is separated by ----- ----- Sample1 5402 6680 Pattern01 Sample2 2216 2368 Pattern02... (6 Replies)
Discussion started by: sam_2921
6 Replies

5. Shell Programming and Scripting

How to get fields in reverse order?

i am having lines like below seperated by "|" (pipe) abc|xyz 123|567 i have to get the above in reverse order xyz|abc 567|123 Pls help (5 Replies)
Discussion started by: suryanarayana
5 Replies

6. UNIX for Dummies Questions & Answers

printing fields in reverse order

command/script(apart from awk) to print the fields in reverse order that is last field has to come first and so on and first field has to go last Input store-id date sale ............. ............. ... (3 Replies)
Discussion started by: tsurendra
3 Replies

7. Shell Programming and Scripting

print in reverse order

Hi, I want to print the item in reverse order such that the output would look like 00 50 50 23 40 22 02 96 Below is the input: 00 05 05 32 04 22 20 69 Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Discussion started by: reignangel2003
5 Replies

8. Shell Programming and Scripting

Delete records in reverse order

Hi all, i have dynamic file 'xyz.txt', records always look likes below format ... 0000021 RET 31-MAR-1984 FAP 0000021 DTA 14-JAN-2003 CNV 0000021 DTA 25-MAR-2012 DTA 0000021 DTA 26-MAR-2012 DTA ################################################# 0000021 DTA ... (4 Replies)
Discussion started by: krupasindhu18
4 Replies

9. UNIX for Beginners Questions & Answers

Issues with sorting in reverse order

I have a unix script that outputs a summary file to the mac desktop. The file is called summary.txt I am trying to configure such so that the summary.txt file lists the content contained within such in reverse sort order. I have used sort -r but it does not seem to work. I would be... (8 Replies)
Discussion started by: Braveheart
8 Replies
postreverse(1)							   User Commands						    postreverse(1)

NAME
postreverse - reverse the page order in a PostScript file SYNOPSIS
postreverse [-o list] [-r] [file] /usr/lib/lp/postscript/postreverse DESCRIPTION
The postreverse filter reverses the page order in files that conform to Adobe's Version 1.0 or Version 2.0 file structuring conventions, and writes the results on the standard output. Only one input file is allowed and if no file is specified, the standard input is read. The postreverse filter can handle a limited class of files that violate page independence, provided all global definitions are bracketed by %%BeginGlobal and %%EndGlobal comments. In addition, files that mark the end of each page with %%EndPage: label ordinal comments will also reverse properly, provided the prologue and trailer sections can be located. If postreverse fails to find an %%EndProlog or %%EndSetup com- ment, the entire file is copied, unmodified, to the standard output. Because global definitions are extracted from individual pages and put in the prologue, the output file can be minimally conforming, even if the input file was not. OPTIONS
-o list Select pages whose numbers are given in the comma-separated list. The list contains single numbers N and ranges N1 - N2. A missing N1 means the lowest numbered page, a missing N2 means the highest. The page range is an expression of logical pages rather than physical sheets of paper. For example, if you are printing two logical pages to a sheet, and you specified a range of 4, then two sheets of paper would print, containing four page layouts. If you specified a page range of 3-4, when requesting two logical pages to a sheet; then only page 3 and page 4 layouts would print, and they would appear on one physical sheet of paper. -r Do not reverse the pages in file. EXAMPLES
Example 1: Examples of postreverse. o select pages 1 to 100 from file and reverse the pages: example% postreverse -o1-100 file To print four logical pages on each physical page and reverse all the pages: example% postprint -n4 file | postreverse To produce a minimally conforming file from output generated by dpost without reversing the pages: example% dpost file | postreverse -r EXIT STATUS
The following exit values are returned: 0 Successful completion. non-zero An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpsf | +-----------------------------+-----------------------------+ SEE ALSO
download(1), dpost(1), postdaisy(1), postdmd(1), postio(1), postmd(1), postprint(1), posttek(1), attributes(5) NOTES
No attempt has been made to deal with redefinitions of global variables or procedures. If standard input is used, the input file will be read three times before being reversed. SunOS 5.10 9 Sep 1996 postreverse(1)
All times are GMT -4. The time now is 05:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy