I have the below plain text file where i have some result, in order to mail that result in html table format I have written the below script and its working well. cat result.txt
Page 2015-01-01 2000
Colors 2015-02-01 3000
Landing 2015-03-02 4000
Now the problem is very rarely these 3 metrics are repeating (refer below), if it repeats i want to identify and generate the separate html table so that when i send email to users they can see 2 separate html tables.
cat result.txt Page 2015-01-01 2000 Colors 2015-02-01 3000 Landing 2015-03-02 4000 Page 2015-01-01 1000 Colors 2015-02-01 2000 Landing 2015-03-02 9000 I tried pattern matching and print the lines but none of my idea's worked could someone help me on this.
Hi all,
I'm looking for some help. I have a file (very long) that is organized like below:
>Cluster 0
0 283nt, >01_FRYJ6ZM12HMXZS... at +/99%
1 279nt, >01_FRYJ6ZM12HN12A... at +/99%
2 281nt, >01_FRYJ6ZM12HM4TS... at +/99%
3 283nt, >01_FRYJ6ZM12HM946... at +/99%
4 279nt,... (4 Replies)
Hi,
My requirement is to search for a paritcular string from a group of .gz files and to print the lines containing that string and the name of the files in which that string is present.
Daily 500 odd .gz files will be generated in a directory(directory name will be in the form of... (4 Replies)
Dear All,
I have a log file like below
13:26:31 |152.22
13:27:31 |154.25
13:28:31 |154.78
13:29:31 |151.23
13:30:31 |145.63
13:31:31 |142.10
13:32:31 |145.45
where values will be there from 00:00 hrs to 23:59 hrs. I'm matching for last occurance of 23:59 and printing 1440 lines (grep... (4 Replies)
I'm using this:
fgrep -f file1.txt file2.txt
To find lines in file1 that match patterns found in file2.
When I add -v:
egrep -v -f file1.txt file2.txt
It won't return non matching lines, I just get a blank.
Can anyone help?
PS. file1.txt contains 3 million lines...each string... (2 Replies)
Hi ,
I have a file which has multiple rows of data, i want to match the pattern for two columns and if both conditions satisfied i have to add the counter by 1 and finally print the count value. How to proceed...
I tried in this way...
awk -F, 'BEGIN {cnt = 0} {if $6 == "VLY278" &&... (6 Replies)
Hi All,
I'm looking to use AWK to pattern match lines in XML file - Example patten for below sample would be /^<apple>/
The sample I wrote out is very basic compared to what I am actually working with but it will get me started
I would like to keep the matched line(s) unchanged but have them... (4 Replies)
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Hi all!
Thanks for taking the time to view this!
I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern.
Example:
Drink a soda
Eat a banana
Eat multiple bananas
Drink an apple juice
Eat an apple
Eat multiple apples
I... (8 Replies)
Hi,
I need to match for the pattern '.py' in my file and print the word which contains.
For example:
cat testfile
a b 3 4.py 5 6
a b.py c.py 4 5 6 7 8
1.py 2.py 3 4 5 6
Expected output:
4.py
b.py c.py
1.py 2.py (3 Replies)
Discussion started by: Sumanthsv
3 Replies
LEARN ABOUT REDHAT
fileutil
fileutil(n) file utilities fileutil(n)
NAME
fileutil - Procedures implementing some file utilities
SYNOPSIS
package require Tcl 8
package require fileutil ?1.4?
::fileutil::cat filename
::fileutil::fileType filename
::fileutil::find ?basedir ?filtercmd??
::fileutil::findByPattern basedir ?-regexp|-glob? ?--? patterns
::fileutil::foreachLine var filename cmd
::fileutil::grep pattern ?files?
::fileutil::stripN path n
::fileutil::stripPwd path
::fileutil::touch ?-a? ?-c? ?-m? ?-r ref_file? ?-t time? filename ?...?
DESCRIPTION
This package provides implementations of standard unix utilities.
::fileutil::cat filename
A tcl implementation of the UNIX cat command. Returns the contents of the specified file. The first argument is the name of the
file to read.
::fileutil::fileType filename
An implementation of the UNIX file command, which uses various heuristics to guess the type of a file. Returns a list specifying as
much type information as can be determined about the file, from most general (eg, "binary" or "text") to most specific (eg, "gif").
For example, the return value for a GIF file would be "binary graphic gif". The command will detect the following types of files:
directory, empty, binary, text, script (with interpreter), executable elf, graphic gif, graphic jpeg, html, xml (with doctype if
available), message pgp, and link.
::fileutil::find ?basedir ?filtercmd??
An implementation of the unix command find. Adapted from the Tcler's Wiki. Takes at most two arguments, the path to the directory to
start searching from and a command to use to evaluate interest in each file. The path defaults to ".", i.e. the current directory.
The command defaults to the empty string, which means that all files are of interest. The command takes care not to loose itself in
infinite loops upon encountering circular link structures. The result of the command is a list containing the paths to the inter-
esting files.
::fileutil::findByPattern basedir ?-regexp|-glob? ?--? patterns
This command is based upon the TclX command recursive_glob, except that it doesn't allow recursion over more than one directory at a
time. It uses ::fileutil::find internally and is thus able to and does follow symbolic links, something the TclX command does not
do. First argument is the directory to start the search in, second argument is a list of patterns. The command returns a list of all
files reachable through basedir whose names match at least one of the patterns. The options before the pattern-list determine the
style of matching, either regexp or glob. glob-style matching is the default if no options are given. Usage of the option -- stops
option processing. This allows the use of a leading '-' in the patterns.
::fileutil::foreachLine var filename cmd
The command reads the file filename and executes the script cmd for every line in the file. During the execution of the script the
variable var is set to the contents of the current line. The return value of this command is the result of the last invocation of
the script cmd or the empty string if the file was empty.
::fileutil::grep pattern ?files?
Implementation of grep. Adapted from the Tcler's Wiki. The first argument defines the pattern to search for. This is followed by a
list of files to search through. The list is optional and stdin will be used if it is missing. The result of the procedures is a
list containing the matches. Each match is a single element of the list and contains filename, number and contents of the matching
line, separated by a colons.
::fileutil::stripN path n
Removes the first n elements from the specified path and returns the modified path. If n is greater than the number of components in
path an empty string is returned.
::fileutil::stripPwd path
If the path is inside of the directory returned by [pwd] it is made relative to that directory. In other words, the current working
directory is stripped from the path. The possibly modified path is returned as the result of the command.
::fileutil::touch ?-a? ?-c? ?-m? ?-r ref_file? ?-t time? filename ?...?
Implementation of touch. Alter the atime and mtime of the specified files. If -c, do not create files if they do not already exist.
If -r, use the atime and mtime from ref_file. If -t, use the integer clock value time. It is illegal to specify both -r and -t. If
-a, only change the atime. If -m, only change the mtime.
KEYWORDS
file utilities
fileutil 1.4 fileutil(n)