I have a Markdown file for logging. Each section has a heading named by date in chronological order. Part of the file is the following.
## 20200628
- Traceback
- [x] code debug
- [x] read Section 2
## 20200629
- Homepage rebuilding
## 20200630
- 13:00: Meeting Tom
I would like to sort the logs in a reverse way, after which it will show like the following.
## 20200630
- 13:00: Meeting Tom
## 20200629
- Homepage rebuilding
## 20200628
- Traceback
- [x] code debug
- [x] read Section 2
I was expecting to use VIM but I didn't figure out what is a proper way to achieve this. Any suggestions would be appreciated a lot. Thanks in advance.
We capture each block using a regex that matches its start, then
we delete it and paste at the beginning of the file.
:$put _ | g/^## 202006[2-3][890]/normal! dapggP
The :$put _ part was used to add a blank line at the end, so each block has a blank line after it.
: .................... vim command mode
$ .................... at end of the file
_ .................... a blank line
| ................... another vim command
g ................... a global command
/ ................... start of a search
^ ................... every start of the line
## .................. two literal ##
202006 ............... literal numbers
[2-3] ............... followed by 2 until 3
[890] ............... followed by 8 9 or zero
/ .................... end of the search
normal! .............. a normal command
dap .................. delete a paragraph
gg ................... jump to the beginning of the file
P .................... put deleted text before the cursor
Related
I'm using a .mrc script to add a data output to irc currently I'm outputting like this -----> [iNFO] - 12 / 125M/S. What I would like to do is output like this [iNFO] - 12F / 125M/S, so what I need is to add the "F" after the 12.
Here's the code snippet I use
`scon 19 msg #test [iNFO] - $remove($strip($4),$chr(44)) F / $remove($strip($6),$chr(44))`
As you can see that outputs like this [iNFO] - 12 F / 125M/S so I need to remove the space between the "12" and the "F".
Any help would be greatly appreciated.
I have many log files, like that
log file 1
2016-09-11_19:40:15.537#15437 [INFO] A1
2016-09-11_19:40:15.537#15437 [WARN] A2
2016-09-11_19:40:15.542#15437 [INFO] A3
log file 2
2016-09-11_19:40:15.537#437 [INFO] B1
2016-09-11_19:40:15.540#437 [INFO] B2
I wish I can merge them by script or other method like that
sort by time
2016-09-11_19:40:15.537#15437 [INFO] A1
2016-09-11_19:40:15.537#15437 [WARN] A2
2016-09-11_19:40:15.537#437 [INFO] B1
2016-09-11_19:40:15.540#437 [INFO] B2
2016-09-11_19:40:15.542#15437 [INFO] A3
How do I to merge the files with efficient way ?
thanks !
Ref: Merging multiple log files by date including multilines
As mentioned in the above question, if you are certain that all the log lines start with timestamp, you can do:
cat logA.log logB.log | sort -n
This would not work when there are other lines such as stack trace which do not start with timestamp.
I think you can check out the above question and answers if your considering a similar scenario.
Try rust-based tool Super Speedy Syslog Searcher
(assuming you have rust installed)
cargo install super_speedy_syslog_searcher
then
s4 --color=never /var/log > logs-merged.log
Super Speedy Syslog Searcher will sort varying log messages by datetime.
Insert all of your files to an empty Notepad++ document.
Edit → Line Operations → Sort Lines Lexicographically Ascending.
I want to save the particular result to the text/excel file through bash.
I tried below command it works fine, but I need only last result passed/failed, not the each step of execution.
I used below command to execute
$ bash eg.sh Behatscripts.txt > output.xls or
$ bash eg.sh Behatscripts.txt > output.txt
Below is the output console in my case, this whole thing is writing into the .txt/.xls file. But I need only last part that is:
1 scenario (1 passed)
3 steps (3 passed)
Executing the Script : eg.feature
----------------------------------------
#javascript
Feature: home page Validation
In order to check the home page of our site
As a website/normal user
I should be able to find some of the links/texts on the home page
Scenario: Validate the links in the header and footer # features\cap_english_home.feature:8
Given I am on the homepage # FeatureContext::iAmOnHomepage()
When I visit "/en" # FeatureContext::assertVisit()
Then I should see the following <links> # FeatureContext::iShouldSeeTheFollowingLinks()
| links |
| Dutch |
1 scenario (1 passed)
3 steps (3 passed)
0m14.744s
Give some suggestion to put condition to save only last part of the output console, thanks in advance.
My problem is explained in the title. I've tried compiling a sample .Rmd I found here: http://www.ssc.wisc.edu/~hemken/Stataworkshops/Stata%20and%20R%20Markdown/
in addition to looking up various resources online to no avail. While my resource, Doug, was able to compile an RMarkdown, I am getting an error for the MWE below.
The MWE is:
---
title: "Stata and R Markdown (Windows)"
author: "Doug Hemken"
date: "July 2015"
output:
html_document:
toc: yes
---
```{r, echo=FALSE, message=FALSE}
require(knitr)
statapath <- "/Applications/Stata/Stata.app"
opts_chunk$set(engine="stata", engine.path=statapath, comment="")
```
### Descriptive Statistics
A simple example.
```{r}
sysuse auto
summarize
```
The output/error from the RStudio console is:
processing file: stata.Rmd
|................ | 25%
ordinary text without R code
|................................ | 50%
label: unnamed-chunk-1 (with options)
List of 2
$ echo : logi FALSE
$ message: logi FALSE
Loading required package: knitr
|................................................. | 75%
ordinary text without R code
|.................................................................| 100%
label: unnamed-chunk-2
running: /Applications/Stata/Stata.app -q -b stata47b9d14e1c.do
Quitting from lines 20-22 (stata.Rmd)
Error in engine(options) :
sh: /Applications/Stata/Stata.app: is a directory
Calls: <Anonymous> ... process_group.block -> call_block -> block_exec -> in_dir -> engine
In addition: Warning message:
running command ''/Applications/Stata/Stata.app' -q -b stata47b9d14e1c.do 2>&1' had status 126
Execution halted
The page you link to points to this page. There, it is written: "For example, if Stata is installed in /Applications/Stata/, then the path to the Stata executable is /Applications/Stata/Stata.app/Contents/MacOS/", and they give appropriate links for all different flavours of Stata. Also, you need to refer to the executable, not the folder where it is located. If I change your MWE as below, everything works for me (note that I use Stata-SE; you might need to change this for your system).
---
title: "Stata and R Markdown (Windows)"
author: "Doug Hemken"
date: "July 2015"
output:
html_document:
toc: yes
---
```{r, echo=FALSE, message=FALSE}
require(knitr)
statapath <- "/Applications/Stata/StataSE.app/Contents/MacOS/stata-se"
opts_chunk$set(engine="stata", engine.path=statapath, comment="")
```
### Descriptive Statistics
A simple example.
```{r}
sysuse auto
summarize
```
I have around 4 files named:
Test_1.csv
Test_2.csv
...
Each line in each test file has the following format:
method;request
Where, method is the URL that I call and request is the request I make to it. Everything is configured to pick up these values and form URLs.
However, first Test_1.csv must run, then Test_2.csv must run and so on. To do that, I have created 5 thread groups in the following hierarchy:
Test Plan
|
+- Step 1
|
+- HTTP request
+- CSV Data Set Config <- Reads from Test_1.csv
+- Uniform Random Timer
+- Step 2
|
+- HTTP request
+- CSV Data Set Config <- Reads from Test_2.csv
+- Uniform Random Timer
And I have also selected the Run thread groups consecutively option in my test plan. Each thread group is configured for 20 threads. Now, what I want it to do is that, Step 1 should run each and every test in Test_1.csv, then Step 2 should execute and run each and every line in Test_2.csv. However, what is happening is that, Step 1 runs the first 20 lines from Test_1.csv and then Step 2 starts, runs 20 tests and continues. Then, after all steps are done, Step 1 runs again and runs the very same 20 lines from Test1.csv. I want it to just run once, loop through all the lines in the test file and then quit and hand over control to the next thread.
How do I go about this?
Try to use the following schema:
Test Plan
Thread Group #1
Number of Threads: N
. . .
While Controller
Condition: ${__javaScript("${request}"!="<EOF>",)} - until the EOF
CSV Data Set Config
Filename: [path to your file with test-data] - Test_1.csv in this case
Variable Names: method,request
HTTP Request
Uniform Random Timer
. . .
Thread Group #2
. . .
[same for Test_2.csv]
Thread Group #3
. . .
[same for Test_3.csv]
jMeter Plugins' ParameterizedController can help you call parts of your test plan like you call functions in a regular programming language. More importantly, you can parametrise those calls with variables.