Sponsored Content
Top Forums Shell Programming and Scripting Looking for help with parsing file contents in bash [newbie] Post 302573247 by ahamed101 on Sunday 13th of November 2011 09:07:10 PM
Old 11-13-2011
If the file is not in the current directory then you need to provide the entire path...
Code:
cat /full/path/to/your/file/log.txt

HTH
--ahamed
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File contents parsing

Suppose I have a file which has either the contents CALLED on <date & time> RUNNING on <date & time>or CALLED on <date & time> RUNNING on <date & time> SHUTTING_DOWN on <date & time> DOWN on <date & time> I don't care about the <date & time> part... I just need to know if the last line in... (3 Replies)
Discussion started by: orno
3 Replies

2. Shell Programming and Scripting

Need help in parsing text file contents

Hi, I need some help in extracting the Exception block between the lines 21 Feb 01:18:54:146 ERROR com.orbits.frameworks.integrationframework.ValidationException - Caught exception in validateRequest() (PID=565584) and 21 Feb 01:18:55:149 INFO ... (0 Replies)
Discussion started by: Alecs
0 Replies

3. Shell Programming and Scripting

parsing a file and manipulating the contents

Hi I have a text file as follows BOB 14/14 TOM 94/94 SAM 3/3 CRIS 13/13 TOM 6/6 CRIS 27/27 SAM 2/2 JACK 25/25 CRIS (6 Replies)
Discussion started by: shellignorant
6 Replies

4. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

5. Shell Programming and Scripting

Most reliable way to store file contents in an array in bash

Hi Guys, I have a file which has numbers in it separated by newlines as follows: 1.113 1.456 0.556 0.021 -0.541 -0.444 I am using the following code to store these in an array in bash: FILE14=data.txt ARRAY14=(`awk '{print}' $FILE14`) (6 Replies)
Discussion started by: npatwardhan
6 Replies

6. Shell Programming and Scripting

parsing a config file using bash

Hi , I have a config _file that has 3 columns (Id Name Value ) with many rows . In my bash script i want to be able to parse the file and do a mapping of any Id value so if i have Id of say brand1 then i can use the name (server5X) and Value (CCCC) and so on ... Id Name ... (2 Replies)
Discussion started by: nano2
2 Replies

7. Shell Programming and Scripting

BASH- Hold script until all contents of a file is written

I have to hit a very large database to pull fields of information. I have a script that runs multiple instance of the same query against the data base and writes contents to a file. The script terminates before the file is completely written to confirmed by ps -ef | grep <script name>... (3 Replies)
Discussion started by: popeye
3 Replies

8. UNIX for Advanced & Expert Users

Parsing a file in bash

Hello All, I have the following input file that i'm trying to parse: 10.0.011.40 hadoop 15526 15524 0 hadoop 15528 15526 0 hadoop 19747 4018 1 10.0.081.227 hadoop 2862 2861 0 hadoop 2864 2862 0 hadoop 12177 14376 1 I'm trying to get this in my output file: 10.0.011.40 15526 15528... (2 Replies)
Discussion started by: ramky79
2 Replies

9. Shell Programming and Scripting

Newbie help - parsing through a file

Hello guys, I am a newbie to all of this - I'd like some help with a file I have. It's a ~100mb CSV file with approximately 30 columns. What I'd like to do is to search through the file and REMOVE any lines with a certain case insensitive string in any of the columns: So my file looks... (4 Replies)
Discussion started by: Lokhtar
4 Replies

10. UNIX for Beginners Questions & Answers

Bash command to find a file and print contents

I need to find a file and print its contents I am trying but it is not working find -path /opt/app-root/src/.npm/_logs -type f -name "*.log" -print Version $ bash -version GNU bash, version 4.4.12(1)-release (x86_64-pc-msys) (1 Reply)
Discussion started by: SVRao19056
1 Replies
File::Spec::OS2(3pm)					 Perl Programmers Reference Guide				      File::Spec::OS2(3pm)

       canonpath
	      No physical check on the filesystem, but a logical cleanup of a path. On UNIX eliminated successive slashes and successive "/.".

       splitpath
		  ($volume,$directories,$file) = File::Spec->splitpath( $path );
		  ($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file );

       Splits a path in to volume, directory, and filename portions. Assumes that the last file is a path unless the path ends in '/', '/.', '/..'
       or $no_file is true.  On Win32 this means that $no_file true makes this return ( $volume, $path, undef ).

       Separators accepted are  and /.

       Volumes can be drive letters or UNC sharenames (\servershare).

       The results can be passed to "catpath" to get back a path equivalent to (usually identical to) the original path.

       splitdir
	      The opposite of catdir().

	   @dirs = File::Spec->splitdir( $directories );

       $directories must be only the directory portion of the path on systems that have the concept of a volume or that have path syntax that dif-
       ferentiates files from directories.

       Unlike just splitting the directories on the separator, leading empty and trailing directory entries can be returned, because these are
       significant on some OSs. So,

	   File::Spec->splitdir( "/a/b//c/" );

       Yields:

	   ( '', 'a', 'b', '', 'c', '' )

       catpath
	      Takes volume, directory and file portions and returns an entire path. Under Unix, $volume is ignored, and this is just like cat-
	      file(). On other OSs, the $volume become significant.

NAME
File::Spec::OS2 - methods for OS/2 file specs SYNOPSIS
require File::Spec::OS2; # Done internally by File::Spec if needed DESCRIPTION
See File::Spec::Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the semantics. perl v5.8.0 2002-06-01 File::Spec::OS2(3pm)
All times are GMT -4. The time now is 11:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy