02-18-2010
Quote:
Originally Posted by
anbu23
How do you differentiate filename and text?
filename has an extension: filename.ext
TEXT is all uppercase
filenames are all lowercase
also there is a trailing special character only on the end of each TEXT string that is not present in any filename
hope that helps
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi Friends,
Can anyone guide me how to compute sum of column4 from the below file x using awk command? when i do using awk I'm getting sum 7482350198352648.000000 which is not accurate.
$ cat x
56,232,dfgjkhdfj,,56,anand
56,22,dfgjkhdfj,7482347823453123.97834 ,56,Khan
56,23,dfgjkhdfj, ... (6 Replies)
Discussion started by: krishna
6 Replies
2. UNIX for Dummies Questions & Answers
Hi,
Does anyone know a easy way to printf $3,$4, ... all the way to the last field in the file? I will need to modify $1 and $2 and then printf modified $1 and $2 and the rest of the fields(which are not changed).
I know I can use NF as the total number of field.
Do I use a for next statement to... (4 Replies)
Discussion started by: whatisthis
4 Replies
3. Shell Programming and Scripting
Hi,
I've got a basic problem using printf statement in awk.
I want to write float values with always 8 characters width.
Examples :
1.345678
12.45678
123.4567
1234.678
-23.5678
-2.45678
-23456.8
.....
I cannot find the right printf format %8.1f, %7.5f....
Can anyone help ?... (4 Replies)
Discussion started by: cazhot
4 Replies
4. Shell Programming and Scripting
Hi friends..
I am confused about awk printf option..
I have a comma separated file
88562848,21-JAN-08,2741079, -1188,-7433,TESTING
88558314,21-JAN-08,2741189, -1273,-7976,TESTING
and there is a line in my script ( written by someone else)
What is the use of command?
I guess... (10 Replies)
Discussion started by: clx
10 Replies
5. Shell Programming and Scripting
echo $bbsize
1.5
echo $fillpercent
.95
echo $bbsize | awk '{printf "%.2f\n",$0*$fillpercent}'
2.25
echo $bbsize | awk '{printf "%.2f\n",$0*.95}'
1.42
1.42 is what I'm expecting...
echo $blocksize
4096
echo $bbsize | awk '{printf "%.2f\n",$0*$blocksize}'
2.25
echo $bbsize |... (3 Replies)
Discussion started by: xgringo
3 Replies
6. Shell Programming and Scripting
Hi Friends,
Scripting newb here. So I'm trying to create a geektool script that uses awk and printf to output certain fields from top (namely command, cpu%, rsize, pid and time, in that order). After much trial and error, I've pretty much succeeded, with one exception. Any process whose name... (3 Replies)
Discussion started by: thom.mattson
3 Replies
7. Shell Programming and Scripting
Hi,
I am using the following code to assign a count value to a variable. But I get nothing. Do you see anything wrong here.
I am new to all this.
$CTR=`remsh $m -l $MACHINES{$m} -n cat $output | grep -v sent | grep \"$input\" | sort -u | awk '{print $5}'`;
Upto sort - u it's... (2 Replies)
Discussion started by: nurani
2 Replies
8. Shell Programming and Scripting
Hello
Here is an easy one
Data file
12345 (tab) Some text (tab) 53.432
23456 (tab) Some longer text (tab) 933.422
34567 (tab) Some different text (tab) 29.309
I need to awk these three tab-delimited columns so that the first two are unchanged (unformatted) and the third shows two decimal... (1 Reply)
Discussion started by: palex
1 Replies
9. Shell Programming and Scripting
I have a very large file with more than 500,000 lines of dated events.
The first field contains the date/time in the following format:
20120727-files.files:20120727090044
where the first 8 numbers represent yyyymmdd. The last set of numbers represent yyyy/mm/dd/hh:mm:ss
I would like to... (4 Replies)
Discussion started by: LDHB2012
4 Replies
10. Shell Programming and Scripting
Please help me format this file:
Source file looks like this, there are three columns, separated by space. First column has varrying width:
1 248105240 W25_2013
10 248103710 W06_2013
100 248103710 W06_2013
1000 248103710 W06_2013
I need to transform the file into a fixed width per column.... (1 Reply)
Discussion started by: tamahomekarasu
1 Replies
LEARN ABOUT DEBIAN
arch::diffparser
Arch::DiffParser(3pm) User Contributed Perl Documentation Arch::DiffParser(3pm)
NAME
Arch::DiffParser - parse file's diff and perform some manipulations
SYNOPSIS
use Arch::DiffParser;
my $dp = Arch::DiffParser->new;
# usable for "annotate" functionality
my $changes = $dp->parse_file("f.diff")->changes;
$dp->parse($diff_content);
$dp->parse("--- f1.c 2005-02-26
+++ f2.c 2005-02-28
...");
# prints "f1.c, f2.c"
printf "%s, %s
", $dp->filename1, $dp->filename2;
# enclose lines in <span class="patch_{mod,orig,line,add,del}">
my $html = $dp->markup_content;
DESCRIPTION
This class provides a limited functionality to parse a single file diff in unified format. Multiple diffs may be parsed sequentially. The
parsed data is stored for the last diff, and is replaced on the following parse.
METHODS
The following class methods are available:
new, parse, parse_file, content, lines, filename1, filename2, mtime1, mtime2, hunks, changes.
new Construct the "Arch::DiffParser" instanse.
parse diff_content
Parse the diff_content and store its parsed data.
parse_file diff_filename
Like parse, but read the diff_content from diff_filename.
diff_data
Return hashref containing certain parsed data. Die if called before any parse methods. The keys are: "lines", "filename1", "filename2",
"mtime1", "mtime2", "hunks", "changes".
The value of "hunks" and "changes" is arrayref of arrayrefs with 5 elements: [ line-number-1, num-lines-1, line-number-2, num-lines-2,
"lines"-index ].
A "hunk" describes a set of lines containing some combination of unmodified, deleted and added lines, a "change" describes an inter-
hunk atom that only contains zero or more deleted lines and zero or more added lines.
lines
filename1
filename2
mtime1
mtime2
hunks
changes
These methods are just shortcuts for diff_data->{method}.
content [%args]
Return content of the last diff.
%args keys are "fileroot1" and "fileroot2"; if given, these will replace the subdirs "orig" and "mod" that arch usually uses in the
filepaths.
markup_content [%args]
Like content, but every non-context line is enclosed into markup <span class="patch_name">line</span>, where name is one of "orig"
(filename1), "mod" (filename2), "line" (hunk linenums), "add" (added), del (deleted).
Not implemented yet.
BUGS
No support for newlines in source file names yet.
AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).
SEE ALSO
For more information, see Text::Diff::Unified, Algorithm::Diff.
perl v5.10.1 2005-03-09 Arch::DiffParser(3pm)