Sponsored Content
Top Forums UNIX for Advanced & Expert Users New To Unix- Need Help With Bash Commands for Printing Post 302711697 by spacebar on Sunday 7th of October 2012 08:21:07 PM
Old 10-07-2012
The example below is just one way you can quickly get the info/counts you want:
Code:
$ cat t
FileName        Date    Pass/Fail
wr_file_load_1  2012-07-03      P
wr_test_load_2  2012-08-01      F
wr_file_load_3  2012-09-13      P
wr_file_load_4  2012-09-18      P
wr_file_load_1  2012-07-05      P


# print a count of files for a specific date that passed and that failed
perl -lnwe 'BEGIN{$p=0; $f=0}; if (/.*\t2012-09-18\tP/) { $p++ } elsif (/.*\t2012-09-18\tF/) { $f++ }; END { print "Counts for 2012-09-18= P: $p  F: $f" }' t

# print the name of the files for a specific date
perl -lne 'print $1 if /(.*)\t2012-09-13\t/' t

# print a list of all dates for which a specific file was processed
perl -lne 'print $1 if /^wr_file_load_1\t(.{10,})\tP/' t

# print file names processed on multiple dates with pass/fail code
perl -lane '%fh;%fc;$fn=$F[0];$pf=$F[2]; $fc{$fn}=$fc{$fn}+1; $fh{$fn} = $pf; END {foreach $fn ( keys %fc ) { print "$fn  $fh{$fn}\n" if $fc{$fn}>1} }' t

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Printing Problems in unix ... ( Bar-cdoe - Ip Printing)

Hi guys ... i need ur help with some printing problem in unix ... first prob. : i wanna print from my NCR unix to an Win NT , Ip based printing server ( HP JetDirect ) . My issue , is it possible to print directly to an Ip address from unix ? How do i make it work to get any results ?... (3 Replies)
Discussion started by: QuickSilver
3 Replies

2. UNIX for Dummies Questions & Answers

Why do basic unix commands not work in BASH

Why do basic unix commands such as "ls" not work in "BASH" mode?? I am frustrated!! (10 Replies)
Discussion started by: PixelLover
10 Replies

3. SCO

SCO Printing commands! Help PLEASE!

Hello All, I am upgrading a server from SCO to LINUX (CENTOS) and have about 50 odd printers which i have transferred. The only problem is, that they have hard coded printer commands which my new version of CUPS does not understand. For example: "-o nb -tl60" Once I know the... (1 Reply)
Discussion started by: stuaz
1 Replies

4. Shell Programming and Scripting

arrays not printing properly in bash

hi guys, i wrote this script and it takes some fields from a file and puts it into three different arrays. The first array works just fine but when I try to use the second array (ARRAY1) all i get is a blank value on the screen.. this works fine..i get ARRAY value on the screen just fine ... (1 Reply)
Discussion started by: npatwardhan
1 Replies

5. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

6. Shell Programming and Scripting

Printing special character in bash

I am using this character as a delimiter 'þ' Currently, I set it straight: DELIMITER='þ' However, while copying the file, this character often gets mangled. Is there a bash way (perhaps using tr or printf) of generating this character. It corresponds to "chr(0xfe)" if using perl. (I've... (6 Replies)
Discussion started by: sentinel
6 Replies

7. Shell Programming and Scripting

Printing the line number in bash script

Hi, I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened. Thanks, (6 Replies)
Discussion started by: suryaemlinux
6 Replies

8. UNIX for Dummies Questions & Answers

Sco Unix printing : jobs hangs in queue - printing via lp versus hpnpf

Hi, We have a Unix 3.2v5.0.5. I installed a printer via scoadmin, HP network printer manager with network peripheral name (hostname and ipadres are in /etc/hosts). This is the configuration file : Code: root@sco1 # cat configurationBanner: on:AlwaysContent types: simpleDevice:... (0 Replies)
Discussion started by: haezeban
0 Replies

9. Shell Programming and Scripting

Creating Printing Program in bash

HI I am trying to create a bash script to print whatever i type in It has to have these below to define the size of the label and what size to print the text N q609 A100,10,0,5,2,2,N," " P1 It has to be sent to below > /dev/usblp0 So what it has to be is Written... (12 Replies)
Discussion started by: bganse
12 Replies

10. Shell Programming and Scripting

How to run several bash commands put in bash command line?

How to run several bash commands put in bash command line without needing and requiring a script file. Because I'm actually a windows guy and new here so for illustration is sort of : $ bash "echo ${PATH} & echo have a nice day!" will do output, for example:... (4 Replies)
Discussion started by: abdulbadii
4 Replies
extract_font_range(3alleg4)					  Allegro manual				       extract_font_range(3alleg4)

NAME
extract_font_range - Extracts a range of characters from a font. Allegro game programming library. SYNOPSIS
#include <allegro.h> FONT *extract_font_range(FONT *f, int begin, int end) DESCRIPTION
This function extracts a character range from a font and returns a new font that contains only the range of characters selected by this function. You can pass -1 for either the lower or upper bound if you want to select all characters from the start or to the end of the font. Example: FONT *myfont; FONT *capitals; FONT *fontcopy; ... /* Create a font of only capital letters */ capitals = extract_font_range(myfont, 'A', 'Z'); /* Create a copy of the font */ fontcopy = extract_font_range(myfont, -1, -1); ... destroy_font(capitals); destroy_font(fontcopy); RETURN VALUE
Returns a pointer to the new font or NULL on error. Remember that you are responsible for destroying the font when you are finished with it to avoid memory leaks. SEE ALSO
get_font_range_begin(3alleg4), get_font_range_end(3alleg4), merge_fonts(3alleg4), transpose_font(3alleg4), exfont(3alleg4) Allegro version 4.4.2 extract_font_range(3alleg4)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy