Sponsored Content
Top Forums Shell Programming and Scripting Grep string in a file and paste next line in a specific way Post 303021931 by RudiC on Monday 20th of August 2018 06:09:04 PM
Old 08-20-2018
Your specification is a bit vague. Find ALL lines with "world" and "page", even if there are more than one? Where to insert them (we can only guess: after a (ALL?) line(s) with "world" and "page" in them)?


Anyhow, all that can't be done with grep. Try (if you've got GNU sed):


Code:
sed "/world.*page/a $(sed -n '/world/ {n;p;q;}' file1)" file2

For other seds, try

Code:
sed "/world.*page/a\
$(sed -n '/world/ {n;p;q;}' file1)" file2

These 2 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

copy and paste a specific line

Hi I am having some trouble cut and paste a file based on the content of another file. I have a file called draft. I need to cut and paste its content to another file based on the content of a file called proc.txt The content of proc.txt is like the following:... (7 Replies)
Discussion started by: tiger99
7 Replies

2. Shell Programming and Scripting

grep on specific line of the file

Hi, how can we search for a word (with case ignore )on specific line numbers ex: Awk /^regEX/ with condition on first line or second line Awk/^ regex1/ on line 1 Awk /^regEX2/ on line 3 thanks in advance (4 Replies)
Discussion started by: rider29
4 Replies

3. Shell Programming and Scripting

grep a specific line from a file

Is there a way to grep only one line from a file listing name of files? If I use head -1 it's ok(the first line only) If I use head -2 it's not good because I have already checked the first line. I'd like something like this: while test $i -le $max do grep "$3" `head -$i temp.txt` >... (4 Replies)
Discussion started by: Max89
4 Replies

4. Shell Programming and Scripting

Deleting a line from a file based on one specific string instance?

Hello! I need to delete one line in a file which matches one very precise instance of a string only. When searching the forum I unfortunately only found a solution which would delete each line on which a particular string occurs. Let's assume I have a file composed of thousands of lines... (4 Replies)
Discussion started by: Black Sun
4 Replies

5. Shell Programming and Scripting

Remove a specific line from grep output string

Dear All I want to search string "1000" from input file and if it found i want remove line that contain 1000 and also remove 3 line above it and 2 line below it. INPUT FILE: BHAT-D 2 aaa ID CODE GS UPDATE MODE LANG MCO MCL NUMPAGES 50 ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

6. Programming

How to grep the specific string or user's list from the file

I have a file on UNIX system from where I want to grep the list of all users associated to the particular repository.If the user's list is in single line then I fetch all list but if it is in two separate lines it doesn't.I use the below command a=KESTREL-DEV;b=users;cat access_file|grep... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

7. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

8. Shell Programming and Scripting

How to grep an empty line in a specific column of a file?

Suppose i have the following data : cat file.txt 12431,123334,55353,546646,14342234,4646,35234 123123,3535,123434,132535,1234134,13535,123534 123213,545465,23434,45646,2342345,4656,31243 2355425,2134324,53425,342,35235,23434,234535 3423424,234234,65465,,2344,35436,234524,234... (7 Replies)
Discussion started by: Ravi Tej
7 Replies

9. UNIX for Dummies Questions & Answers

Commenting a line matched with a specific string in a file

Hi, I would like to comment a line that matched a string "sreenivas" in a file without opening it. Thanks in advance. Regards, Sreenivas (3 Replies)
Discussion started by: raosr020
3 Replies

10. Shell Programming and Scripting

Grep pattern after specific line number in a file

Hi guys, I am running a while loop in a script ro read a file line by line. Now I want to run a grep only on the lines below the line I am that is being read by the while loop. Eg: If my while loop is on line 4 of the file, the grep only runs below line 4 and does not include line 1,2... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies
BVRML(3pm)						User Contributed Perl Documentation						BVRML(3pm)

NAME
XRacer::BVRML - Parser for a tiny subset of VRML generated by Blender SYNOPSIS
use XRacer::BVRML; DESCRIPTION
This is a parser for a tiny subset of VRML generated by Blender, so called Blender-VRML or BVRML. In fact, this parser is by no means guaranteed to be able to parse everything that Blender could generate. I will add parsing capability to it as I see the need. "XRacer::BVRML" parses a Blender VRML file, and stores it in an internal world representation, which can be inspected and manipulated. "XRacer::BVRML" can also write out a C function containing GL commands which render this world object, and this function can then be used inside an XRacer track or craft file. CLASS METHODS
$world = XRacer::BVRML->parse ($filename [, $world]); This function parses a BVRML file called $filename, and generates a $world object. If the second optional $world parameter is given, then the BVRML file is parsed and the results are merged with the existing $world object. If the parsing fails, then this function will print an error message and return "undef". WORLD OBJECT METHODS
$nr_vertices = $world->nr_vertices; Return the total number of vertices in the world. $nr_faces = $world->nr_faces; Return the total number of faces in the world. @vertices = $world->vertices; Aggregate all vertices in the world, and return it as a list. @faces = $world->faces; Aggregate all faces in the world, and return it as a list. ($smallest_x, $largest_x, $smallest_y, $largest_y, $smallest_z, $largest_z) = $world->bbox; Return the bounding box (or bounding cuboid, to be more precise) of this world. $world->write_display_function ([name => $function_name,] [filehandle => $filehandle,] [decl => $decl]); Write out a C function containing GL calls which, when invoked, will display this world object. The C function is called $function_name and will be written to the file specified by the $filehandle. The function will be declared as "void function_name (void)" unless the $decl parameter is given, which gives the return declaration. The C function is suitable for directly linking into XRacer craft and track files. However, it requires some support. In particular, you will need to include the header file GL/gl.h, and probably xracer.h before the function. AUTHOR
Richard W.M. Jones, <rich@annexia.org> COPYRIGHT
XRacer is copyright (C) 1999-2000 Richard W.M. Jones (rich@annexia.org) and other contributors listed in the AUTHORS file. SEE ALSO
perl(1), xracer(6). perl v5.14.2 2000-01-07 BVRML(3pm)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy