Sponsored Content
Top Forums Shell Programming and Scripting Grabbing a chunk of text from a file Post 302673883 by in2nix4life on Wednesday 18th of July 2012 01:48:53 PM
Old 07-18-2012
Code:
awk '/Report Start/,/Report End/' < report.txt > report-new.txt

cat report-new.txt

Report Start
e r dfkf lsdk dslsdklsdk
Report Start: xxxxxxdad
asdffsdfsdfsdfasfasdffasdf
sadfasdfsadffsfsdf Report End.

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grabbing a value from an output file

I am executing a stored proc and sending the results in a log file. I then want to grab one result from the output parameters (bolded below, 2) so that I can store it in a variable which will then be called in another script. There are more details that get printed in the beginning of the log file,... (3 Replies)
Discussion started by: hern14
3 Replies

2. Shell Programming and Scripting

Read Write byte range/chunk of data from specific location in file

I am new to Unix so will really appreciate if someone can guide me on this. What I want to do is: Step1: Read binary file - pick first 2 bytes, convert from hex to decimal. Read the next 3 bytes as well. 2 bytes will specify the number of bytes 'n' that I want to read and write... (1 Reply)
Discussion started by: Kbenipel
1 Replies

3. Shell Programming and Scripting

grabbing filename from text file....should be easy!

Quick question...I'm trying to grab the .tif file name from this output from our fax server. What is the best way i can do this in a bash script? I have been looking at regular expressions with bash or using awk but having some trouble. thanks! The only output i want is... (5 Replies)
Discussion started by: kuliksco
5 Replies

4. Shell Programming and Scripting

Grabbing text and using that text in a newly created line

Hello, I am really stuck and I'm hoping somone can help. I have a text file that is similar to this: <--First User--> <function>account='uid=user1,....... <--Second User--> <function>account='uid=user2,.......What I want is to grab the usernames after "uid=" and before the following... (9 Replies)
Discussion started by: mafia910
9 Replies

5. Shell Programming and Scripting

Delete chunk of text if contains certain strings

Using awk how to delete chunk of text if it contains certain strings? As in the following, delete a reference chunk, i.e. everything from <reference attribute = "value"> to </reference> inclusive, if within it "Group ID" value is 7 or 96 or 103 or 1005. <reference attribute = "value"> ... (3 Replies)
Discussion started by: pioavi
3 Replies

6. Shell Programming and Scripting

Grabbing top line of text in a file and setting it to a variable

If I have a txt file with test.txt somelineoftext and I want to set that line of text to variable in a script: so #!/bin/bash var='' becomes #!/bin/bash var='somelineoftext' (3 Replies)
Discussion started by: digitalviking
3 Replies

7. Shell Programming and Scripting

Grabbing data between 2 points in text file

I have a text file that shows the output of my solar inverters. I want to separate this into sections. overview , device 1 , device 2 , device 3. Each device has different number of lines. but they all have unique starting points. Overview starts with 6 #'s, Devices have 4#'s and their data starts... (6 Replies)
Discussion started by: Mikey
6 Replies

8. Shell Programming and Scripting

Isolating a chunk of text using php

greetings, i'll start by stating; i am NOT looking for the EXACT syntax to my query but a simple yes or no of its possibility. and if you're feeling generous maybe the php function(s) that i'd use as a jump start. i could use bash but i really want to take a shot at doing this with php. the... (0 Replies)
Discussion started by: crimso
0 Replies

9. Shell Programming and Scripting

Grabbing text between two lines with shell variables.

I would like to grab complex html text between lines using variables. I am running Debian and using mksh shell. Here is the part of the html that I want to extract from. I would like to extract the words 'to love,' and I would like to use the above and below lines as reference points. ... (3 Replies)
Discussion started by: bedtime
3 Replies
Module::Versions::Report(3pm)				User Contributed Perl Documentation			     Module::Versions::Report(3pm)

NAME
Module::Versions::Report -- report versions of all modules in memory SYNOPSIS
use Module::Versions::Report; ...and any code you want... This will run all your code normally, but then as the Perl interpreter is about to exit, it will print something like: Perl v5.6.1 under MSWin32. Modules in memory: attributes; AutoLoader v5.58; Carp; Config; DynaLoader v1.04; Exporter v5.562; Module::Versions::Report v1.01; HTML::Entities v1.22; HTML::HeadParser v2.15; HTML::Parser v3.25; [... and whatever other modules were loaded that session...] Consider its use from the command line: % perl -MModule::Versions::Report -MLWP -e 1 Perl v5.6.1 under MSWin32. Modules in memory: attributes; AutoLoader v5.58; [...] DESCRIPTION
I often get email from someone reporting a bug in a module I've written. I email back, asking what version of the module it is, what version of Perl on what OS, and sometimes what version of some relevent third library (like XML::Parser). They reply, saying "Perl 5". I say "I need the exact version, as reported by "perl -v"". They tell me. And I say "I, uh, also asked about the version of my module and XML::Parser [or whatever]". They say "Oh yeah. It's 2.27". "Is that my module or XML::Parser?" "XML::Parser." "OK, and what about my module's version?" "Ohyeah. That's 3.11." By this time, days have passed, and what should have been a simple operation -- reporting the version of Perl and relevent modules, has been needlessly complicated. This module is for simplifying that task. If you add "use Module::Versions::Report;" to a program (especially handy if your program is one that demonstrates a bug in some module), then when the program has finished running, you well get a report detailing the all modules in memory, and noting the version of each (for modules that defined a $VERSION, at least). USING
Importing If this package is imported then END block is set, and report printed to stdout on a program exit, so use "use Module::Versions::Report;" if you need a report on exit or "use Module::Versions::Report ();" otherwise and call report or print_report functions yourself. report and print_report functions The first one returns preformatted report as a string, the latter outputs a report to stdout. COPYRIGHT AND DISCLAIMER
Copyright 2001-2003 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. MAINTAINER
Ruslan U. Zakirov <ruz@bestpractical.com> AUTHOR
Sean M. Burke, <sburke@cpan.org> perl v5.10.0 2008-10-21 Module::Versions::Report(3pm)
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy