Sponsored Content
Top Forums Shell Programming and Scripting Move a line to top of the file Post 302864651 by Akshay Hegde on Thursday 17th of October 2013 01:46:20 AM
Old 10-17-2013
One more lengthy way

may try

Code:
$ awk 'BEGIN{while(1){getline;if(/Output/){printf $0;break}x=x RS $0}print x}1'  file

OR
Code:
$ awk '{if(/Output/)printf $0;else x=x RS $0}END{print x}' file

Resulting
Code:
Output view:
AAA
BBBB
CCCC
XXXX
YYYY
ZZZZ


Last edited by Akshay Hegde; 10-17-2013 at 03:54 AM..
This User Gave Thanks to Akshay Hegde For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

how to move file pointer to a particular line in c

Hello experts, I ve a text file I want to go to particular line . what is the best way to do this in c ? I am tried as follows fseek ( fh, pos, SEEK_SET); but this functions moves the file pointer according to a number of bytes. Unfortunately I don't know the exact byte... (7 Replies)
Discussion started by: user_prady
7 Replies

2. Shell Programming and Scripting

how to move the line after a certain pattern in the file

Hi, I have a file called /bb/bin/rstrt. I need to move the line/entry "ccpm_load_shared_memory" after the entry "initcorp". The problem is that there are several entries for "initcorp" in this file and I need the entry to be moved only after the first instance of "initcorp" Is there a way... (5 Replies)
Discussion started by: aoussenko
5 Replies

3. Shell Programming and Scripting

find top 100 files and move them

i have some 1000 files in my dir and i want to find top 100 files and move them to some other location: below the 2 commands i used, but it is not working ls -ltr | grep ^- | head -100 | xargs mv destination - _________>not working ls -ltr | grep ^- | head -100 | xargs mv {}... (3 Replies)
Discussion started by: ali560045
3 Replies

4. AIX

want to remove some line from top of file.

Hi All, I have AIX 5.3 server. I have one big file. in that i want to remove 5000 line from top. is there any command for this? Thanks, Vishal (6 Replies)
Discussion started by: vishalpatel03
6 Replies

5. Shell Programming and Scripting

best way to insert a line at the top of a file?

say I want to insert "this is a test" as the first line into file A, besides echo "this is a test" > /tmp/tmpfile cat /tmp/tmpfile fileA >> /tmp/result, is there any simple way I can do it? thanks (7 Replies)
Discussion started by: fedora
7 Replies

6. Shell Programming and Scripting

Move a line to end of file

Can somebody help me with a script .... Read a file /etc/inittab find the string starting with rcml and move it entirely towards the end of file. rcml:2:once:/usr/sni/aix52/rc.ml > /dev/console 2>&1 I basically want to change the startup sequence. (2 Replies)
Discussion started by: imanuk2007
2 Replies

7. Shell Programming and Scripting

append a line into a file in the top

hi, My code is #!/bin/sh echo "\n\nPlease enter the month of the year(YYYYMM) : \c" read date_rep INPUT_L9_FILE=L9_Recharge_Description_EOM_$date_rep.csv #This part is used to summarise Grand_Total, Balance_Total of file L9_Recharge_Description_EOM_${1}.csv. awk -F"," '{if(NR!=1)... (5 Replies)
Discussion started by: madfox
5 Replies

8. Shell Programming and Scripting

Use sed to move last line to top

I have parsed a curl download with sed commands. I would also like to move the last line in the output file to the top. Can I use sed for this? (3 Replies)
Discussion started by: jostber
3 Replies

9. UNIX for Dummies Questions & Answers

add a new line on top of a file

infile a b c A E F 1 2 3 outfile new line a b c A E F 1 2 3 I tried: sed '1i\ new line' infile > outfilecat outfile new linea b c A E F 1 2 3 I don't want the new line be added to the existing first line. Thanks Joseph (7 Replies)
Discussion started by: jdhahbi
7 Replies

10. Shell Programming and Scripting

Move a text to next line in a file

Hi , I need your help for the below issue. I have a file which has data as below An error came (/u01/app/12.csv) pkg1.func1: detail s 1111-->pkg1.func1: detail s 2222--> Now pkg1.func1: .... --> can come multiple times in the second line. I need to arrange the data in the below... (9 Replies)
Discussion started by: bhaski2012
9 Replies
GLRAD(1)						      General Commands Manual							  GLRAD(1)

NAME
glrad - render a RADIANCE scene using OpenGL SYNOPSIS
glrad [ -w ][ -b ][ -s ][ -S ][ -v view ] rfile [ VAR=value .. ] DESCRIPTION
Glrad renders a Radiance scene description in OpenGL. Its syntax and behavior is similar to rad(1) with the -o option, where the output device is assumed to be an X11 server with GLX extensions. The -w option turns off warnings. The -s option tells glrad to run rad silently, not echoing oconv(1) command. The -b option turns off back face visibility (i.e., enables back face culling). This is equivalent to the -bv option of rpict(1) and rvu(1). The -S option turns on full-screen stereo for displays that support it. (Be sure to run /usr/gfx/setmon(1) or its equivalent to set STR_TOP or STR_BOT, first.) The -v option may be used to specify a starting view, either by symbolic name as entered in the view assignments in rfile, or by a complete view specification, enclosed in quotes. If no view is specified, then the first standard view from rfile is used to start. Variables permitted in rfile are described in the rad manual page. Additional or overriding assignments may be given on the command line following rfile. The view is controlled via the mouse and simple one-character commands, listed below: (mouse) Modify the current view. The mouse is used to control the current view in the following ways: CONTROL MOUSE ACTION (none) left Move forward towards cursor position (none) right Move backward away from cursor position (none) middle Rotate in place (usually safe) shift left Orbit left around cursor position shift right Orbit right around cursor position shift middle Orbit skyward cntl middle Orbit earthward For all movements but rotating in place, the cursor must be placed over some bit of visible geometry, otherwise the program has no reference point from which to work. It is best to just experiment with these controls until you learn to fly safely in your model. And if you run into trouble, the 'l' command is very useful. (See below.) '+' Zoom in on the current cursor position. (Beware of repeating keys that go faster than the display updates.) '-' Zoom out from the current cursor position. 'l' Return to the last saved view. Each time a new command changes the current view, the last view is saved, and may be recalled with this command. Multiple uses of the same command (e.g., rotation, zoom) will save only the view before the first such com- mand. This way, it is easy to get back to where you were before a sequence of view changes. 'h' Fix the head height. All mouse-controlled view motions will be adjusted so that the head height does not change (where vertical is determined by the current view up vector). 'H' Release the head height, allowing it to change again during mouse-controlled movements. 'v' Print the current view parameters to the standard output. This is useful for finding out where you are, or for saving specific views in a keyframe file for animations or returning to later. 'V' Append the current view to the original rfile. This view will be unnamed, but can be referred to by number or the user may add a name later with a text editor. The current view number becomes the last standard view. (See the 'n' and 'p' commands, below.) 'n' Go to the next standard view stored in rfile. If the last view is currently displayed, then cycle to the first one. 'p' Go to the previous standard view stored in rfile. If the first view is currently displayed, then cycle to the last one. 'q' Quit glrad. This is the normal way to exit the program. AUTHOR
Greg Ward Larson BUGS
It would be nice if glrad set the appropriate video format for stereo viewing automatically, but the process is different on different sys- tems and there is no single, sure-fire way to do it for all systems. On systems that do not support stereo extensions, the program may be compiled with the -DNOSTEREO option, which will avoid undefined symbol errors. SEE ALSO
chmod(1), getinfo(1), ls(1), objview(1), oconv(1), ps(1), rad(1), ranimate(1), rhcopy(1), rholo(1), rpict(1), rtrace(1), rvu(1), setmon(1) RADIANCE
6/10/98 GLRAD(1)
All times are GMT -4. The time now is 06:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy