Sponsored Content
Top Forums Shell Programming and Scripting move contents from one file to another based on line number or content Post 302423220 by robp2175 on Thursday 20th of May 2010 11:40:59 AM
Old 05-20-2010
move contents from one file to another based on line number or content

I want a script that will move everything beyond a certain line number or beyond a certain content word into another file.
For example, if file A has this:
first line
second line
third line
forth line
fifth line
sixth line

I want to run a script that will move everything beyond the third line to the END of file B, OR it would be even better if the script will move everything beyond the specific words "third line" into file B. That way I could just put in some random characters where I want the cutoff to be and never have to worry about the line number. I am not very good at scripting and do not know where to start. Any help would be greatly appreciated.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split File Based on Line Number Pattern

Hello all. Sorry, I know this question is similar to many others, but I just can seem to put together exactly what I need. My file is tab delimitted and contains approximately 1 million rows. I would like to send lines 1,4,& 7 to a file. Lines 2, 5, & 8 to a second file. Lines 3, 6, & 9 to... (11 Replies)
Discussion started by: shankster
11 Replies

2. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

3. Shell Programming and Scripting

Extract string from multiple file based on line count number

Hi, I search all forum, but I can not find solutions of my problem :( I have multiple files (5000 files), inside there is this data : FILE 1: 1195.921 -898.995 0.750312E-02-0.497526E-02 0.195382E-05 0.609417E-05 -2021.287 1305.479-0.819754E-02 0.107572E-01 0.313018E-05 0.885066E-05 ... (15 Replies)
Discussion started by: guns
15 Replies

4. Shell Programming and Scripting

join based on line number when one file is missing lines

I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like: 1 200.3 -0.3 2 201.7 -0.32 ... 87 200.2 -0.314 I have another file which contains data that was taken at certain of these 87 positions. i.e.: 37 125 42 175 86 142 where the first... (1 Reply)
Discussion started by: jackiev
1 Replies

5. Shell Programming and Scripting

Splitting a file based on line number

Hi I have a file with over a million lines (rows) and I want to split everything from 500,000 to a million into another file (to make the file smaller). Is there a simple command for this? Thank you Phil (4 Replies)
Discussion started by: phil_heath
4 Replies

6. Shell Programming and Scripting

How to split a file based on pattern line number?

Hi i have requirement like below M <form_name> sdasadasdMklkM D ...... D ..... M form_name> sdasadasdMklkM D ...... D ..... D ...... D ..... M form_name> sdasadasdMklkM D ...... M form_name> sdasadasdMklkM i want split file based on line number by finding... (10 Replies)
Discussion started by: bhaskar v
10 Replies

7. Shell Programming and Scripting

Sort file based on number of delimeters in line

Hi, Need to sort file based on the number of delimeters in the lines. cat testfile /home/oracle/testdb /home /home/oracle/testdb/newdb /home/oracle Here delimeter is "/" expected Output: /home/oracle/testdb/newdb /home/oracle/testdb /home/oracle /home (3 Replies)
Discussion started by: Sumanthsv
3 Replies

8. Shell Programming and Scripting

Insert content of a file to another file at a line number which is given by third file

Hi friends, here is my problem. I have three files like this.. cat file1.txt ======= unix is best unix is best linux is best unix is best linux is best linux is best unix is best unix is best cat file2.txt ======== Windows performs better Mac OS performs better Windows... (4 Replies)
Discussion started by: Jagadeesh Kumar
4 Replies

9. Shell Programming and Scripting

Move multiple files 4rm Source to different target folders based on a series num in the file content

Dear Experts my scenario is as follows... I have one source folder "Source" and 2 target folders "Target_123456" & "Target_789101". I have 2 series of files. 123456 series and 789101 series. Each series has got 3 types of fiels "Debit", "Refund", "Claims". All files are getting... (17 Replies)
Discussion started by: phani333
17 Replies
PODOFOPAGES(1)							    podofopages 						    PODOFOPAGES(1)

NAME
podofopages - move and delete pages in a PDF document SYNOPSIS
podofopages [--delete] [--move] [inputfile] [outputfile] DESCRIPTION
podofopages is one of the command line tools from the PoDoFo library that provide several useful operations to work with PDF files. It can move and delete pages in a PDF document. OPTIONS
--delete NUMBER Deletes the page NUMBER (number is 0-based). The page will not really be deleted from the PDF. It is only removed from the so called pagestree and therefore becomes hidden. The content of the page can still be retrieved from the document though. --move FROM TO Moves a page FROM TO in the document (FROM and TO are 0-based). SEE ALSO
podofobox(1), podofocountpages(1), podofocrop(1), podofoencrypt(1), podofoimg2pdf(1), podofoimgextract(1), podofoimpose(1), podofoincremen- talupdates(1), podofomerge(1), podofopdfinfo(1), podofotxt2pdf(1), podofotxtextract(1), podofouncompress(1), podofoxmp(1) AUTHORS
PoDoFo is written by Dominik Seichter <domseichter@web.de> and others. This manual page was written by Oleksandr Moskalenko <malex@debian.org> for the Debian Project (but may be used by others). PoDoFo 2010-12-09 PODOFOPAGES(1)
All times are GMT -4. The time now is 07:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy