Sponsored Content
Top Forums Shell Programming and Scripting grabbing filename from text file....should be easy! Post 302411833 by durden_tyler on Friday 9th of April 2010 02:00:07 PM
Old 04-09-2010
Code:
vfxstat 1378410 | perl -lne '/^File.* (.*?)$/ && print $1'

tyler_durden
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies

2. Shell Programming and Scripting

Remove filename is text file

Hello, I got files full path in a text file like that /main/k/kdelibs/kdelibs4c2a_3.5.10.dfsg.1-2ubuntu7_i386.deb /main/k/kdelibs-experimental/libknotificationitem-dev_4.3.2-0ubuntu1_i386.deb /main/k/kdemultimedia/dragonplayer_4.3.2-0ubuntu1_i386.deb... (13 Replies)
Discussion started by: davidkhan
13 Replies

3. Shell Programming and Scripting

Easy way to pull a paragraph from a text file?

I have a collection of text files that comprise a mailing list archive. I grep them to find an email that interests me, then open the file in a text editor to find the surrounding paragraph of text. Is there an easy way to do this from the shell instead? (2 Replies)
Discussion started by: CRGreathouse
2 Replies

4. Shell Programming and Scripting

parsing filename and grabbing specific string patterns

Hi guys...Wow I just composed a huge post and it got erased as I was logged out automatically Anyways I hope someone can help me out here. So the task I'm working on is like this I have a bunch of files that I care about sitting in a directory say $HOME/files Now my job is to go and loop... (6 Replies)
Discussion started by: rukasetsuna
6 Replies

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

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 a chunk of text from a file

Hi, I have a Report.txt file. Say the contents of this file are : 1 2 3 4 5 7 df v g gf e r dfkf lsdk dslsdklsdk Report Start: xxxxxxdad asdffsdfsdfsdfasfasdffasdf sadfasdfsadffsfsdf Report End. sdfasdfasdf sdfasfdasdfasdfasdfasdf sadfasdfsdf I need to grab from Report Start... (3 Replies)
Discussion started by: mrskittles99
3 Replies

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

9. Shell Programming and Scripting

awk to place specific contents filename within text file

I am trying to use awk to place the contens of a filename in $1 and $2 followed by the data in the text file. Basically, put the filename within the text file. There are over 1000 files in the directory and as of now each file is saved with a unique name but it is not within the file. Thank you... (10 Replies)
Discussion started by: cmccabe
10 Replies

10. 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
IO::File(3pm)						 Perl Programmers Reference Guide					     IO::File(3pm)

NAME
IO::File - supply object methods for filehandles SYNOPSIS
use IO::File; $fh = new IO::File; if ($fh->open("< file")) { print <$fh>; $fh->close; } $fh = new IO::File "> file"; if (defined $fh) { print $fh "bar "; $fh->close; } $fh = new IO::File "file", "r"; if (defined $fh) { print <$fh>; undef $fh; # automatically closes the file } $fh = new IO::File "file", O_WRONLY|O_APPEND; if (defined $fh) { print $fh "corge "; $pos = $fh->getpos; $fh->setpos($pos); undef $fh; # automatically closes the file } autoflush STDOUT 1; DESCRIPTION
"IO::File" inherits from "IO::Handle" and "IO::Seekable". It extends these classes with methods that are specific to file handles. CONSTRUCTOR
new ( FILENAME [,MODE [,PERMS]] ) Creates an "IO::File". If it receives any parameters, they are passed to the method "open"; if the open fails, the object is destroyed. Otherwise, it is returned to the caller. new_tmpfile Creates an "IO::File" opened for read/write on a newly created temporary file. On systems where this is possible, the temporary file is anonymous (i.e. it is unlinked after creation, but held open). If the temporary file cannot be created or opened, the "IO::File" object is destroyed. Otherwise, it is returned to the caller. METHODS
open( FILENAME [,MODE [,PERMS]] ) "open" accepts one, two or three parameters. With one parameter, it is just a front end for the built-in "open" function. With two or three parameters, the first parameter is a filename that may include whitespace or other special characters, and the second parameter is the open mode, optionally followed by a file permission value. If "IO::File::open" receives a Perl mode string (">", "+<", etc.) or an ANSI C fopen() mode string ("w", "r+", etc.), it uses the basic Perl "open" operator (but protects any special characters). If "IO::File::open" is given a numeric mode, it passes that mode and the optional permissions value to the Perl "sysopen" operator. The permissions default to 0666. For convenience, "IO::File" exports the O_XXX constants from the Fcntl module, if this module is available. SEE ALSO
perlfunc, "I/O Operators" in perlop, IO::Handle IO::Seekable HISTORY
Derived from FileHandle.pm by Graham Barr <gbarr@pobox.com>. perl v5.8.0 2002-06-01 IO::File(3pm)
All times are GMT -4. The time now is 03:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy