Sponsored Content
Full Discussion: move to a particular line
Top Forums Shell Programming and Scripting move to a particular line Post 302363279 by ghostdog74 on Tuesday 20th of October 2009 12:57:35 AM
Old 10-20-2009
if your "positions" are by space delimited fields, with bash
Code:
#!/bin/bash
i=1
while read -r a b c d e f g h
do
 if [ "$i" -eq 15 ];then 
    echo "$g"
 fi 
 i=$((i+1))
done < 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
CUBRID_LOB2_READ(3)							 1						       CUBRID_LOB2_READ(3)

cubrid_lob2_read - Read from BLOB/CLOB data.

SYNOPSIS
string cubrid_lob2_read (resource $lob_identifier, int $len) DESCRIPTION
The cubrid_lob2_read(3) function reads $len bytes from the LOB data and returns the bytes read. PARAMETERS
o $lob_identifier -Lob identifier as a result of cubrid_lob2_new(3) or get from the result set. o $len -Length from buffer you want to read from the lob data. RETURN VALUES
Returns the contents as a string. FALSE when there is no more data. NULL on failure. EXAMPLES
Example #1 cubrid_lob2_read(3) example 1 <?php // test_lob (id INT, contents CLOB) $conn = cubrid_connect("localhost", 33000, "demodb", "public", ""); $req = cubrid_execute($conn, "select * from test_lob"); $row = cubrid_fetch_row($req, CUBRID_LOB); print "position now is " . cubrid_lob2_tell($row[1]) . " "; cubrid_lob2_seek($row[1], 10, CUBRID_CURSOR_FIRST); print " position after moving farword is " . cubrid_lob2_tell($row[1]) . " "; $data = cubrid_lob2_read($row[1], 12); print " position after reading is " . cubrid_lob2_tell($row[1]) . " "; print $data . " "; cubrid_lob2_seek($row[1], 5, CUBRID_CURSOR_CURRENT); print " position after moving again is " . cubrid_lob2_tell($row[1]) . " "; $data = cubrid_lob2_read($row[1], 20); print $data . " "; cubrid_disconnect($conn); ?> Example #2 cubrid_lob2_read(3) example 2 <?php // test_lob (id INT, contents CLOB) $conn = cubrid_connect("localhost", 33000, "demodb", "dba", ""); $req = cubrid_execute($conn, "select * from test_lob"); $row = cubrid_fetch_row($req, CUBRID_LOB); while (true) { if ($data = cubrid_lob2_read($row[1], 1024)) { print $data . " "; } elseif ($data === false) { print "There is no more data "; break; } else { print "There must some errors "; break; } } cubrid_disconnect($conn); ?> SEE ALSO
cubrid_lob2_write(3), cubrid_lob2_seek(3), cubrid_lob2_seek64(3), cubrid_lob2_tell(3), cubrid_lob2_tell64(3), cubrid_lob2_size(3), cubrid_lob2_size64(3). PHP Documentation Group CUBRID_LOB2_READ(3)
All times are GMT -4. The time now is 12:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy