Sponsored Content
Top Forums Shell Programming and Scripting How do I include the file being compared into calculation? Post 302585270 by llcooljatt on Wednesday 28th of December 2011 03:58:01 AM
Old 12-28-2011
output


Code:
#nawk -F, 'NR==FNR{a[$1OFS$2OFS$3]++;next} a[$1OFS$2OFS$3]{b[$1OFS$2OFS$3]++}
 END{for(i in b){if(b[i]-1){print i"\t\t"b[i]-1}else{print "NEW :"i} } }' OFS=, 20111127.csv *.csv | sort -r
NEW :NE:571209,SHELF:18,SLOT:6
NEW :NE:566030,SHELF:2,SLOT:6
NEW :NE:564588,SHELF:5,SLOT:6
NEW :NE:556029,SHELF:8,SLOT:5
NEW :NE:510150,SHELF:9,SLOT:5
NEW :NE:508622,SHELF:10,SLOT:1
NEW :NE:20107650,SHELF:2,SLOT:4
NE:985068,SHELF:6,SLOT:4                1
NE:985068,SHELF:4,SLOT:1                2
NE:600866,SHELF:8,SLOT:3                20
NE:571209,SHELF:6,SLOT:1                51
NE:571209,SHELF:3,SLOT:3                14
NE:571209,SHELF:18,SLOT:2               1
NE:565808,SHELF:3,SLOT:4                1
NE:565229,SHELF:14,SLOT:1               2
NE:556029,SHELF:5,SLOT:2                3
NE:503284,SHELF:6,SLOT:3                14
NE:321636,SHELF:16,SLOT:1               4
NE:249314,SHELF:8,SLOT:1                6
NE:230388,SHELF:10,SLOT:2               2
NE:222268,SHELF:7,SLOT:6                34
NE:20173322,SHELF:5,SLOT:5              2
NE:20170632,SHELF:3,SLOT:3              12


it still shows the 1's it should be 2 does not look like it is including 20111127.csv file in calculation
 

9 More Discussions You Might Find Interesting

1. Programming

Not able to compile Pro*c file due - give errors and points to /usr/include/.. file

I am trying to compile the pro*C file but gives errors. It says it encountered "std" while it was expecting ; , = ( $ $ORACLE_HOME/bin/proc tradewind/dataaccess/Blob.pcc Pro*C/C++: Release 10.2.0.3.0 - Production on Fri May 9 11:10:54 2008 Copyright (c) 1982, 2005, Oracle. All rights... (0 Replies)
Discussion started by: shafi2all
0 Replies

2. UNIX for Dummies Questions & Answers

calculation on a large file

Trying to do some simple maths on a large file. Excel works fine but I have 1 million entries: If the difference between a number in column 2 and the one above it is more than 100 the insert a new line 8 4001 4100 8 4101 4200 8 4201 4300 8 15901 16000 8 15910 ... (1 Reply)
Discussion started by: dr_sabz
1 Replies

3. Shell Programming and Scripting

File Size calculation with AWK

Hello Friends, Im calculating file sizes with below AWK script. I do this before some spesific files are transferred. I run the script it works but after several running it stuck with a limit of 2147483647 (2 Gbytes -1 byte) and cant exceed this. Something is wrong and I can't proceed, would... (1 Reply)
Discussion started by: EAGL€
1 Replies

4. Shell Programming and Scripting

include file name to extracted files

I've written the script below to merge only .txt files that exist in one directory into one huge .txt file and ignore other files with other extensions. now the result is one huge .txt file with all the contents of other .txt files how can i add a File Name as a comment before each file? ... (12 Replies)
Discussion started by: miss_dodi
12 Replies

5. Shell Programming and Scripting

Calculation from a file

Hi , I have a file with below format 6/1/200618:00:011348797339524635352499218493964052971 6/1/200617:00:011348672070311735349025833693964052971 6/1/200616:00:011348546711070035345679259193964052971 I want a output as below 6/1/200618:00:011348797339524635352499218493964052971... (1 Reply)
Discussion started by: manojit123
1 Replies

6. Shell Programming and Scripting

math calculation for a txt file

Hi All, I have a text file which is only one column. I want to multiply all these values in file1.txt by 0.01 and get the output.txt file1.txt 65 85 90 ... output.txt 0.65 0.85 0.90 ... Thanks. Please use code tags when posting data and code samples! (2 Replies)
Discussion started by: senayasma
2 Replies

7. Shell Programming and Scripting

Need to include two more columns in the file using awk

Hi, I have a input file with many records as below: 1J4RR4GG0BC508200 68646 1 N M i want my output file to be like with columns included dgismdh and timestamp : Example: 1J4RR4GG0BC508200 68646 1 N M dgismdh 2012-02-21 07:22:25.98591 How to do it.can we do using awk? Pls help. (6 Replies)
Discussion started by: sonam273
6 Replies

8. Shell Programming and Scripting

Get file name which include the current date

Hi, I'm trying to get the name of a file that has the current date in the name. The filename is on the form A<current date>01.DC, for example A2012110501.DC I have this script so far date +%y%m%d D=$(date +%y%m%d) N=A20$D echo $N N2={$N}01.DC echo $N2 And gets the following... (12 Replies)
Discussion started by: Immelstorn
12 Replies

9. Shell Programming and Scripting

Help with awk percentage calculation from a file

i have a file say test with the below mentioned details Folder Name Total space Space used /test/test1 500.1GB 112.0 GB /test/test2 3.2 TB 5TB /test/test3 3TB 100GB i need to calculate percentage of each row based on total space and space used and copy... (9 Replies)
Discussion started by: venkitesh
9 Replies
QProgressDialog(3qt)													      QProgressDialog(3qt)

NAME
QProgressDialog - Feedback on the progress of a slow operation SYNOPSIS
#include <qprogressdialog.h> Inherits QDialog. Public Members QProgressDialog ( QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 ) QProgressDialog ( const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 ) ~QProgressDialog () void setLabel ( QLabel * label ) void setCancelButton ( QPushButton * cancelButton ) void setBar ( QProgressBar * bar ) bool wasCancelled () const (obsolete) bool wasCanceled () const int totalSteps () const int progress () const virtual QSize sizeHint () const QString labelText () const void setAutoReset ( bool b ) bool autoReset () const void setAutoClose ( bool b ) bool autoClose () const int minimumDuration () const Public Slots void cancel () void reset () void setTotalSteps ( int totalSteps ) void setProgress ( int progress ) void setProgress ( int progress, int totalSteps ) void setLabelText ( const QString & ) void setCancelButtonText ( const QString & cancelButtonText ) void setMinimumDuration ( int ms ) Signals void cancelled () (obsolete) void canceled () Properties bool autoClose - whether the dialog gets hidden by reset() bool autoReset - whether the progress dialog calls reset() as soon as progress() equals totalSteps() QString labelText - the label's text int minimumDuration - the time that must pass before the dialog appears int progress - the current amount of progress made int totalSteps - the total number of steps bool wasCanceled - whether the dialog was canceled (read only) bool wasCancelled - whether the dialog was canceled (read only) (obsolete) Protected Slots void forceShow () DESCRIPTION
The QProgressDialog class provides feedback on the progress of a slow operation. A progress dialog is used to give the user an indication of how long an operation is going to take, and to demonstrate that the application has not frozen. It can also give the user an opportunity to abort the operation. A common problem with progress dialogs is that it is difficult to know when to use them; operations take different amounts of time on different hardware. QProgressDialog offers a solution to this problem: it estimates the time the operation will take (based on time for steps), and only shows itself if that estimate is beyond minimumDuration() (4 seconds by default). Use setTotalSteps() (or the constructor) to set the number of" steps" in the operation and call setProgress() as the operation progresses. The step value can be chosen arbitrarily. It can be the number of files copied, the number of bytes received, the number of iterations through the main loop of your algorithm, or some other suitable unit. Progress starts at 0, and the progress dialog shows that the operation has finished when you call setProgress() with totalSteps() as its argument. The dialog automatically resets and hides itself at the end of the operation. Use setAutoReset() and setAutoClose() to change this behavior. There are two ways of using QProgressDialog: modal and modeless. Using a modal QProgressDialog is simpler for the programmer, but you must call QApplication::processEvents() or QEventLoop::processEvents(ExcludeUserInput) to keep the event loop running to ensure that the application doesn't freeze. Do the operation in a loop, call setProgress() at intervals, and check for cancellation with wasCanceled(). For example: QProgressDialog progress( "Copying files...", "Abort Copy", numFiles, this, "progress", TRUE ); for ( int i = 0; i < numFiles; i++ ) { progress.setProgress( i ); qApp->processEvents(); if ( progress.wasCanceled() ) break; //... copy one file } progress.setProgress( numFiles ); A modeless progress dialog is suitable for operations that take place in the background, where the user is able to interact with the application. Such operations are typically based on QTimer (or QObject::timerEvent()), QSocketNotifier, or QUrlOperator; or performed in a separate thread. A QProgressBar in the status bar of your main window is often an alternative to a modeless progress dialog. You need to have an event loop to be running, connect the canceled() signal to a slot that stops the operation, and call setProgress() at intervals. For example: Operation::Operation( QObject *parent = 0 ) : QObject( parent ), steps( 0 ) { pd = new QProgressDialog( "Operation in progress.", "Cancel", 100 ); connect( pd, SIGNAL(canceled()), this, SLOT(cancel()) ); t = new QTimer( this ); connect( t, SIGNAL(timeout()), this, SLOT(perform()) ); t->start( 0 ); } void Operation::perform() { pd->setProgress( steps ); //... perform one percent of the operation steps++; if ( steps > pd->totalSteps() ) t->stop(); } void Operation::cancel() { t->stop(); //... cleanup } In both modes the progress dialog may be customized by replacing the child widgets with custom widgets by using setLabel(), setBar(), and setCancelButton(). The functions setLabelText() and setCancelButtonText() set the texts shown. [Image Omitted] [Image Omitted] See also QDialog, QProgressBar, GUI Design Handbook: Progress Indicator, and Dialog Classes. MEMBER FUNCTION DOCUMENTATION
QProgressDialog::QProgressDialog ( QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 ) Constructs a progress dialog. Default settings: The label text is empty. The cancel button text is (translated) "Cancel". The total number of steps is 100. The creator argument is the widget to use as the dialog's parent. The name, modal, and the widget flags, f, are passed to the QDialog::QDialog() constructor. If modal is FALSE (the default), you must have an event loop proceeding for any redrawing of the dialog to occur. If modal is TRUE, the dialog ensures that events are processed when needed. See also labelText, setLabel(), setCancelButtonText(), setCancelButton(), and totalSteps. QProgressDialog::QProgressDialog ( const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 ) Constructs a progress dialog. The labelText is text used to remind the user what is progressing. The cancelButtonText is the text to display on the cancel button, or 0 if no cancel button is to be shown. The totalSteps is the total number of steps in the operation for which this progress dialog shows progress. For example, if the operation is to examine 50 files, this value would be 50. Before examining the first file, call setProgress(0). As each file is processed call setProgress(1), setProgress(2), etc., finally calling setProgress(50) after examining the last file. The creator argument is the widget to use as the dialog's parent. The name, modal, and widget flags, f, are passed to the QDialog::QDialog() constructor. If modal is FALSE (the default), you will must have an event loop proceeding for any redrawing of the dialog to occur. If modal is TRUE, the dialog ensures that events are processed when needed. See also labelText, setLabel(), setCancelButtonText(), setCancelButton(), and totalSteps. QProgressDialog::~QProgressDialog () Destroys the progress dialog. bool QProgressDialog::autoClose () const Returns TRUE if the dialog gets hidden by reset(); otherwise returns FALSE. See the "autoClose" property for details. bool QProgressDialog::autoReset () const Returns TRUE if the progress dialog calls reset() as soon as progress() equals totalSteps(); otherwise returns FALSE. See the "autoReset" property for details. void QProgressDialog::cancel () [slot] Resets the progress dialog. wasCanceled() becomes TRUE until the progress dialog is reset. The progress dialog becomes hidden. void QProgressDialog::canceled () [signal] This signal is emitted when the cancel button is clicked. It is connected to the cancel() slot by default. See also wasCanceled. void QProgressDialog::cancelled () [signal] This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. Use canceled() instead. Examples: void QProgressDialog::forceShow () [protected slot] Shows the dialog if it is still hidden after the algorithm has been started and minimumDuration milliseconds have passed. See also minimumDuration. QString QProgressDialog::labelText () const Returns the label's text. See the "labelText" property for details. int QProgressDialog::minimumDuration () const Returns the time that must pass before the dialog appears. See the "minimumDuration" property for details. int QProgressDialog::progress () const Returns the current amount of progress made. See the "progress" property for details. void QProgressDialog::reset () [slot] Resets the progress dialog. The progress dialog becomes hidden if autoClose() is TRUE. See also autoClose and autoReset. Example: network/ftpclient/ftpmainwindow.ui.h. void QProgressDialog::setAutoClose ( bool b ) Sets whether the dialog gets hidden by reset() to b. See the "autoClose" property for details. void QProgressDialog::setAutoReset ( bool b ) Sets whether the progress dialog calls reset() as soon as progress() equals totalSteps() to b. See the "autoReset" property for details. void QProgressDialog::setBar ( QProgressBar * bar ) Sets the progress bar widget to bar. The progress dialog resizes to fit. The progress dialog takes ownership of the progress bar which will be deleted when necessary, so do not use a progress bar allocated on the stack. void QProgressDialog::setCancelButton ( QPushButton * cancelButton ) Sets the cancel button to the push button, cancelButton. The progress dialog takes ownership of this button which will be deleted when necessary, so do not pass the address of an object that is on the stack, i.e. use new() to create the button. See also setCancelButtonText(). void QProgressDialog::setCancelButtonText ( const QString & cancelButtonText ) [slot] Sets the cancel button's text to cancelButtonText. See also setCancelButton(). void QProgressDialog::setLabel ( QLabel * label ) Sets the label to label. The progress dialog resizes to fit. The label becomes owned by the progress dialog and will be deleted when necessary, so do not pass the address of an object on the stack. See also labelText. Example: progress/progress.cpp. void QProgressDialog::setLabelText ( const QString & ) [slot] Sets the label's text. See the "labelText" property for details. void QProgressDialog::setMinimumDuration ( int ms ) [slot] Sets the time that must pass before the dialog appears to ms. See the "minimumDuration" property for details. void QProgressDialog::setProgress ( int progress ) [slot] Sets the current amount of progress made to progress. See the "progress" property for details. void QProgressDialog::setProgress ( int progress, int totalSteps ) [slot] This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Sets the current amount of progress to progress and the total number of steps to totalSteps. See also totalSteps. void QProgressDialog::setTotalSteps ( int totalSteps ) [slot] Sets the total number of steps to totalSteps. See the "totalSteps" property for details. QSize QProgressDialog::sizeHint () const [virtual] Returns a size that fits the contents of the progress dialog. The progress dialog resizes itself as required, so you should not need to call this yourself. int QProgressDialog::totalSteps () const Returns the total number of steps. See the "totalSteps" property for details. bool QProgressDialog::wasCanceled () const Returns TRUE if the dialog was canceled; otherwise returns FALSE. See the "wasCanceled" property for details. bool QProgressDialog::wasCancelled () const Returns TRUE if the dialog was canceled; otherwise returns FALSE. See the "wasCancelled" property for details. Property Documentation bool autoClose This property holds whether the dialog gets hidden by reset(). The default is TRUE. See also autoReset. Set this property's value with setAutoClose() and get this property's value with autoClose(). bool autoReset This property holds whether the progress dialog calls reset() as soon as progress() equals totalSteps(). The default is TRUE. See also autoClose. Set this property's value with setAutoReset() and get this property's value with autoReset(). QString labelText This property holds the label's text. The default text is QString::null. Set this property's value with setLabelText() and get this property's value with labelText(). int minimumDuration This property holds the time that must pass before the dialog appears. If the expected duration of the task is less than the minimumDuration, the dialog will not appear at all. This prevents the dialog popping up for tasks that are quickly over. For tasks that are expected to exceed the minimumDuration, the dialog will pop up after the minimumDuration time or as soon as any progress is set. If set to 0, the dialog is always shown as soon as any progress is set. The default is 4000 milliseconds. Set this property's value with setMinimumDuration() and get this property's value with minimumDuration(). int progress This property holds the current amount of progress made. For the progress dialog to work as expected, you should initially set this property to 0 and finally set it to QProgressDialog::totalSteps(); you can call setProgress() any number of times in-between. Warning: If the progress dialog is modal (see QProgressDialog::QProgressDialog()), this function calls QApplication::processEvents(), so take care that this does not cause undesirable re-entrancy in your code. For example, don't use a QProgressDialog inside a paintEvent()! See also totalSteps. Set this property's value with setProgress() and get this property's value with progress(). int totalSteps This property holds the total number of steps. The default is 0. Set this property's value with setTotalSteps() and get this property's value with totalSteps(). bool wasCanceled This property holds whether the dialog was canceled. Get this property's value with wasCanceled(). See also progress. bool wasCancelled This property holds whether the dialog was canceled. This property is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. Use wasCanceled instead. Get this property's value with wasCancelled(). SEE ALSO
http://doc.trolltech.com/qprogressdialog.html http://www.trolltech.com/faq/tech.html COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. AUTHOR
Generated automatically from the source code. BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qprogressdialog.3qt) and the Qt version (3.3.8). Trolltech AS 2 February 2007 QProgressDialog(3qt)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy