I have following log:
File Process Start : 2014-03-12 - 10:43:40
UnZipping File : fetch_export?id=t63184&file=4
Extracted File : exp_4.mbx
Expected Messages : 6236
File Process Start : 2014-03-12 - 10:57:38
UnZipping File : fetch_export?id=t63185&file=39
Extracted File :
Expected Messages : 0
File Process Start : 2014-03-12 - 10:57:38
UnZipping File : fetch_export?id=t63185&file=33
Extracted File :
Expected Messages : 0
File Process Start : 2014-03-12 - 10:57:38
UnZipping File : fetch_export?id=sept2012&file=61
Extracted File : exp_61.mbx
Expected Messages : 7935
What i need to change in this command?
sed -n '/File Process Start/,/Expected Messages/p'
I need output only between
File Process Start
...
Expected Messages : 0
Like this:
File Process Start : 2014-03-12 - 10:57:38
UnZipping File : fetch_export?id=t63185&file=39
Extracted File :
Expected Messages : 0
File Process Start : 2014-03-12 - 10:57:38
UnZipping File : fetch_export?id=t63185&file=33
Extracted File :
Expected Messages : 0
The idea is to print the lines between "File Process Start..." and "Expected Messages : 0". The issue is that you don't know beforehand if you will find the "Expected Messages : 0" or "Expected Messages : X". So, starting at the "File Process Start", keep saving the lines in the hold space until you are able to decide if you will print them or discard them.
sed -n '/Expected Messages : 0/{H;g;p};/.*/H;/File Process Start/h' log.txt
The pseudocode is:
If the line contains "Expected Messages : 0", (h) append this line in the hold space (at this point, the hold space will have the lines "File Process Start ...", "UnZipping File..." and "Extracted File..."), (g) get the content from the hold space to the pattern space (i.e. the lines from "File Process Start..." until the last one you just appended), (p) print the content of the pattern space.
If the line contains anything else, (H) append it to the hold space.
If the line contains "File Process Start", (h) wipe out what's in the hold space and put this new line there.
This might work for you (GNU sed):
sed -n '/File Process Start/{h;d};H;/Expected Messages : 0/{g;p}' file
Related
We want some functionality where we can export the report using the command line so that we can execute that command through some batch file and export reports on a daily schedule time.
Issue:
For this ,we are trying some code snippet from Tally developer "Help --> TDL Sample"(this is complete path of sample code C:\Program Files\TallyPrimeDeveloper\Samples\Whats New\Rel 3.x\Rel 3.0\Programmable Configurations\Export Report Trial Balance.txt).
The following code sample works properly on button click and we are successfully exported the report in our folder
"""[Button: TSPL Smp Export PC]
Key : Ctrl + E
Action : Call : TSPL Smp PC Export Report
Title : "Export Report"
;; Function Definition begins
[Function: TSPL Smp PC Export Report]
Local Formula : SysDate : $$SysInfo:SystemDate
00 : SET : SVExportLocation : "."
10 : SET : SVExportFormat : $$SysName:PDF
20 : SET : SVPrintFileName : "List of Ledgers as onShri_1234 " + $$String:#SysDate + ".PDF"
30 : SET : SVPrintFileName : $$MakeExportName:##SVPrintFileName:##SVExportFormat
40 : EXPORT REPORT : . : TRUE
50 : Msg Box : "TestMsg2" :"We need to download this report through command line" """
But we are facing issue when we are trying to call this same function through command line
Command line is : "C:\Program Files\TallyPrime\tally.exe" /Load:10000 /Action:Call:TSPLSmpPCExportReport .
As per our observations and debugging, the above function gets successfully called through the command line because when I am executing it through the command line,I am getting a "TestMsg2" popup but the file is not getting exported. It seems there is some issue only in file export through the command line, not in function calling through the command line.
I have a solution that works, but without TDL and uses C# or Python
Using C# you can create console app, and you can use that in command line
using Python, you can create script and run from command line
Refer this video for python
I am attempting to merge three ntuples (just an example but there are more) stored in a directory that are labeled as the following:
[1] mc16a_SUSY.root
[2] mc16d_SUSY.root
[3] mc16e_SUSY.root
[4] ......
To do this I am using the command hadd (hadd outputfile inputfiles..)
os.system(hadd -f Combined_SUSY_SAMPLES.root mc16*SUSY*.root)
For the output file I want to combine all files with mc16 and SUSY in the file name
But I receive the error:
hadd Target file: Combined_SUSY_SAMPLES.root
hadd compression setting for all output: 1
hadd Source file 1: mc16*SUSY*.root
Error in <TFile::TFile>: file mc16*SUSY*.root does not exist
Error in <TFileMerger::AddFile>: cannot open file mc16*SUSY*.root
hadd exiting due to error in mc16*SUSY*.root
It states that there aren't any files with mc16*SUSY*.root but these files do exist. Any solutions? Thanks for the help in advance.
I use the "*" because there are to many files to list them individually.
I'm late to respond here, but could it be that you don't have the full path to the files? Some databases will send you the file names with certain commands, but not the absolute locations. It could be that you need to append the folder to the beginning of the filename.
You get logcat output from Unity by using the following command;
adb logcat -s Unity
Here is a typical log message that each output call would generate;
02-16 09:17:09.245 18683 27815 I Unity : I [HTTPRequest]: Sending request: POST /ws/1/entry/1/global HTTP/1.1
02-16 09:17:09.245 18683 27815 I Unity :
02-16 09:17:09.245 18683 27815 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
How can I use grep to return the first line above but not the 2nd or 3rd lines? I know that I can use -v to invert the matching, and therefore can remove the 'DebugBindings' line using the following;
adb logcat -s Unity | grep -v DebugBindings
But how can I also exclude the empty lines?
grep -Ev '^.*?Unity\s*:$' file
-E grep with extended-regexp
.*?Unity allow all characters until first occurrence of the word "Unity"
\s*:$ allow any number of spaces followed by : and end of line
I am trying to setup a symbol server, and hence I need the symbols indexed to map to the source version.
I am running p4Index on folder where the solution resides.
my disc files and folders:
.\CalculatorDemo\bin\ where the output is produced
.\CalculatorDemo\CalculatorApp\ contains source
.\CalculatorDemo\CalculatorDll\ contains source
.\CalculatorDemo\CalculatorTest\ contains source
In my version control the path in the depot is:
//sw/Main/Internal/CalculatorDemo/
and my workspace is:
c:\Projects\Dev\sw\Main\Internal\CalculatorDemo\
When I try to index it I get no files found..
C:\projects\dev\sw\main\Internal\CalculatorDemo>p4Index -debug
---
ssindex.cmd [STATUS] : Server ini file: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv\srcsrv.ini
ssindex.cmd [STATUS] : Source root : C:\projects\dev\sw\main\Internal\CalculatorDemo
ssindex.cmd [STATUS] : Symbols root : C:\projects\dev\sw\main\Internal\CalculatorDemo
ssindex.cmd [STATUS] : Control system : P4
ssindex.cmd [STATUS] : P4 program name: p4.exe
ssindex.cmd [STATUS] : P4 Label :
ssindex.cmd [STATUS] : Old path root :
ssindex.cmd [STATUS] : New path root :
ssindex.cmd [STATUS] : Partial match : Not enabled
---
ssindex.cmd [STATUS] : Running... this will take some time...
ssindex.cmd [INFO ] : ... indexing C:\projects\dev\sw\main\Internal\CalculatorDemo\bin\x64 \Debug\CalculatorApp.pdb
ssindex.cmd [INFO ] : ... zero source files found ...
ssindex.cmd [INFO ] : ... indexing C:\projects\dev\sw\main\Internal\CalculatorDemo\bin\x64\Debug\CalculatorDll.pdb
ssindex.cmd [INFO ] : ... zero source files found ...
ssindex.cmd [INFO ] : ... indexing C:\projects\dev\sw\main\Internal\CalculatorDemo\bin\x64 \Debug\CalculatorTest.pdb
I cannot seem to get the hole through and get the file version info into the pdb's. - (I am doing this on my developer maschine, because I want to get the script working before I involve our build server)
Does anyone know (yes offcause someone does) how I can get the problem debugged/fixed. I probably has to do som perl debuggin or something. - I suspect that it could be a problem with not pointing to the rigth place
on the perforce server...
Thanks in advance
Kenneth
I just had something similar this morning.
I'll share my solution if it can help some.
The p4 environment variable weren't properly set in my case.
You can either set them manually or go in P4V, Connection -> Environment Settings..., don't change anything and press OK.
To make sure they're properly set, open a command prompt and type "p4 set", you should see a set of variables reflecting information on your current connection to Perforce.
Hope this helps.
I am getting the following exceptions in my Mongo
13,08 07:06:06:356 [|||] [ajp-bio-9207-exec-3] ERROR errors.GrailsExceptionResolver - CommandFailureException occurred when processing request: [POST] /MerchantBridge_stable/saks/importdata
{ "serverUsed" : "10.157.192.16:27017" , "ok" : 0.0 , "errmsg" : "Can't take a write lock while out of disk space" , "code" : 14031}. Stacktrace follows:
com.mongodb.CommandFailureException: { "serverUsed" : "10.157.192.16:27017" , "ok" : 0.0 , "errmsg" : "Can't take a write lock while out of disk space" , "code" : 14031}
at com.mongodb.CommandResult.getException(CommandResult.java:76)
at com.mongodb.CommandResult.throwOnError(CommandResult.java:131)
at com.mongodb.DBCollection.drop(DBCollection.java:1015)
I am guessing I need to set something in the mongod.conf file.
Any tips?
Using this guide by Josh Barber, you simply need to increase the machine's disk space! Try running df in the command line to view the machine's current disk space utilization, you're probably close to 100%.
Another option is to nuke it from orbit! If you're using a VM, you could always scrap it and rebuild. This will require a full rebuild, but that might be easier than trying to repartition your VM's hard drive.