Sponsored Content
Full Discussion: move to a particular line
Top Forums Shell Programming and Scripting move to a particular line Post 302363287 by ghostdog74 on Tuesday 20th of October 2009 01:51:38 AM
Old 10-20-2009
Quote:
Originally Posted by rdcwayx
Code:
cat urfile| sed -n 15p |awk '{print $7}'


Code:
awk 'NR==15{print $7}' file

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. Shell Programming and Scripting

move to a particular position and line

Hi, How can i move to particular line and to a particular position in a file using unix commands ? eg: in the line 30 and position 10 i want to print my name in a file. Cheers, Mohan (1 Reply)
Discussion started by: mohanpadamata
1 Replies

4. 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

5. Shell Programming and Scripting

move datestamp to beginning of line where available

My current output is as follows: All Day Event Someone's Birthday Class 7:00 PM Pick up dry cleaning 1:00 PM Wake up 8:00 AM I'd like the output to remain the same but have the times moved to the beginning of the line with a hyphen after it so it would look like, All Day Event... (3 Replies)
Discussion started by: chrish
3 Replies

6. Shell Programming and Scripting

awk script to move a line after the matched pattern line

I have the following text format in a file which lists the question first and then 5 choices after that the explanantion and finally the answer. 1.The amount of time it takes for most of a worker’s occupational knowledge and skills to become obsolete has been declining because of the... (2 Replies)
Discussion started by: nanchil_guy
2 Replies

7. Shell Programming and Scripting

Move lines above a line onto one line

So say I have the file: john london 24 male ======== jane london 22 female ======== mike 23 ======== Bob how do i get the information i need on one line as such: (5 Replies)
Discussion started by: linuxkid
5 Replies

8. UNIX for Dummies Questions & Answers

How move characters following a semicolon to a new line

Hello, I was wondering how I can move this: ABC;>12 BLA;>67 DEF;>22 into this ABC >12 BLA >67 DEF >22 thanks for your help. (1 Reply)
Discussion started by: blakers
1 Replies

9. Shell Programming and Scripting

Need a help to move control to another line in my script

I have menu option in my script and in that i have 4 options like below :- echo "Please select a target server .." echo " AIX - AIX1" echo " AIX - AIX2" echo " AIX - AIX3" echo " HP-UX - HP-UX1" echo "Enter your menu choice : \n" read tgtser ... (8 Replies)
Discussion started by: Renjesh
8 Replies

10. Shell Programming and Scripting

Move a line to top of the file

Hi, I have a following file and it has only one occurrence of line that says "Output view:". It could be in middle somewhere ( i don't know the exact location ). I want to move it as the first line of the file. Input AAA BBBB CCCC Output view: XXXX YYYY ZZZZ Output should be: Output... (13 Replies)
Discussion started by: jakSun8
13 Replies
fold(1) 							   User Commands							   fold(1)

NAME
fold - filter for folding lines SYNOPSIS
fold [-bs] [-w width | -width] [file...] DESCRIPTION
The fold utility is a filter that will fold lines from its input files, breaking the lines to have a maximum of width column positions (or bytes, if the -b option is specified). Lines will be broken by the insertion of a NEWLINE character such that each output line (referred to later in this section as a segment) is the maximum width possible that does not exceed the specified number of column positions (or bytes). A line will not be broken in the middle of a character. The behavior is undefined if width is less than the number of columns any single character in the input would occupy. If the CARRIAGE-RETURN, BACKSPACE, or TAB characters are encountered in the input, and the -b option is not specified, they will be treated specially: BACKSPACE The current count of line width will be decremented by one, although the count never will become negative. fold will not insert a NEWLINE character immediately before or after any BACKSPACE character. CARRIAGE-RETURN The current count of line width will be set to 0. fold will not insert a NEWLINE character immediately before or after any CARRIAGE-RETURN character. TAB Each TAB character encountered will advance the column position pointer to the next tab stop. Tab stops will be at each column position n such that n modulo 8 equals 1. OPTIONS
The following options are supported: -b Counts width in bytes rather than column positions. -s If a segment of a line contains a blank character within the first width column positions (or bytes), breaks the line after the last such blank character meeting the width constraints. If there is no blank character meeting the requirements, the -s option will have no effect for that output segment of the input line. -w width|-width Specifies the maximum line length, in column positions (or bytes if -b is specified). If width is not a positive decimal number, an error is returned. The default value is 80. OPERANDS
The following operand is supported: file A path name of a text file to be folded. If no file operands are specified, the standard input will be used. EXAMPLES
Example 1: Submitting a file of possibly long lines to the line printer An example invocation that submits a file of possibly long lines to the line printer (under the assumption that the user knows the line width of the printer to be assigned by lp(1)): example% fold -w 132 bigfile | lp ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of fold: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 All input files were processed successfully. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
cut(1), pr(1), attributes(5), environ(5), standards(5) NOTES
fold and cut(1) can be used to create text files out of files with arbitrary line lengths. fold should be used when the contents of long lines need to be kept contiguous. cut should be used when the number of lines (or records) needs to remain constant. fold is frequently used to send text files to line printers that truncate, rather than fold, lines wider than the printer is able to print (usually 80 or 132 column positions). fold may not work correctly if underlining is present. SunOS 5.10 1 Feb 1995 fold(1)
All times are GMT -4. The time now is 08:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy