lines

Batch file to delete first 3 lines of a text file

本小妞迷上赌 提交于 2019-12-27 17:45:42
问题 As the title states I need a batch file to delete the FIRST 3 lines of a text file. for example: A B C D E F G in this example I need A,B and C deleted along with the line 回答1: This should do it for /f "skip=3 delims=*" %%a in (C:\file.txt) do ( echo %%a >>C:\newfile.txt ) xcopy C:\newfile.txt C:\file.txt /y del C:\newfile.txt /f /q That will re-create the file with the first 3 lines removed. To keep the user updated you could integrate messages in the batch file in vbscript style or output

Plot multiple lines (data series) each with unique color in R

坚强是说给别人听的谎言 提交于 2019-12-27 11:38:45
问题 I am fairly new to R and I have the following queries : I am trying to generate a plot in R which has multiple lines (data series). Each of these lines is a category and I want it to have a unique color. Currently my code is setup in this way : First, I am creating an empty plot : plot(1,type='n',xlim=c(1,10),ylim=c(0,max_y),xlab='ID', ylab='Frequency') Then for each of my category, I am plotting lines in this empty plot using a "for" loop like so : for (category in categories){ lines(data

Plot multiple lines (data series) each with unique color in R

十年热恋 提交于 2019-12-27 11:38:07
问题 I am fairly new to R and I have the following queries : I am trying to generate a plot in R which has multiple lines (data series). Each of these lines is a category and I want it to have a unique color. Currently my code is setup in this way : First, I am creating an empty plot : plot(1,type='n',xlim=c(1,10),ylim=c(0,max_y),xlab='ID', ylab='Frequency') Then for each of my category, I am plotting lines in this empty plot using a "for" loop like so : for (category in categories){ lines(data

Getting division by zero error with Python and OpenCV

◇◆丶佛笑我妖孽 提交于 2019-12-25 17:05:58
问题 I am using this code to remove the lines from the following image: I don't know the reason, but it gives me as output ZeroDivisionError: division by zero error on line 34 - x0, x1, y0, y1 = (0, im_wb.shape[1], sum(y0_list)/len(y0_list), sum(y1_list)/len(y1_list)) . What's the reason ? How can I fix it ? import cv2 import numpy as np img = cv2.imread('lines.png',0) # Applies threshold and inverts the image colors (thresh, im_bw) = cv2.threshold(img, 128, 255, cv2.THRESH_BINARY | cv2.THRESH

Fastest way to test for a minimum number of lines or tokens

纵然是瞬间 提交于 2019-12-25 09:13:34
问题 I have twice now found myself wanting to know whether a Javascript string has a minimum number of lines but not wanting to wastefully split the string to find out. Both times took excessive experimentation with regular expressions to realize that the solution was simple. This self-answered post is here to prevent me (and hopefully others) from having to re-figure this out. More generally, I want to efficiently determine whether any given string has at least a specified number of tokens. I don

SED: Move multiple lines to the end of a text file

旧巷老猫 提交于 2019-12-24 15:20:07
问题 I want to move multiple lines using SED to the end of a file . For example: ABCDEF GHIJKL MNOPQR STUVWX YZ1234 should become: STUVWX YZ1234 ABCDEF GHIJKL MNOPQR 回答1: The question asks a method for using sed to move multiple lines . Although the question, as currently edited, does not show multiple lines, I will assume that they are actually meant to be separate lines. To use sed to move the first three lines to the end: $ cat file ABCDEF GHIJKL MNOPQR STUVWX YZ1234 $ sed '1,3{H;d}; ${p;x;s/^

Add whiskers (horizontal lines) to multiple boxplots

萝らか妹 提交于 2019-12-24 04:34:12
问题 I need to add whisker (or horizontal lines) to my multiple box-plots. You can find my dataset here: link to data is broken... In other words, I am plotting three variables (Mat, Ita, and Log) divided by Gender (F and M), in order to compare their box plots. I need to add an horizontal line at the end of both vertical lines in each box plot. I am using ggplot2 package and the code I am using so far is (this code allows me to create the box plots as I need them, I only need to add the

bash - remove multiple different lines of text from a text file

北城以北 提交于 2019-12-24 02:33:38
问题 I'm working with lots of log files, and most log files have lots of repeating strings that are logged multiple times. To make the logs easily viewable for others who don't have much to do with such things (for myself also), i've wanted to make a script that rips out some text lines that can cause a 'false alarm' to other people. ("Hey admin, i have these errors here multiple times"; > "Sigh, these errors don't mean anything" kind of way) Is there some bash code with grep, cat or awk that can

Powershell - how to obtain previous lines from text file?

烈酒焚心 提交于 2019-12-23 09:11:47
问题 I have a text file containing hundreds of lines of text containing database info. I'm trying to extract the DatabaseId s for any database which is 35GB. I would like to interrogate the file using Powershell and produce a text file containing all the matching databases. So in essence, I would like to scan through the file, find a DatabaseSize which is 35 and then extract the corresponding DatabaseId from 3 lines previous. I've looked all over the net but can't seem to find anything which can

Powershell - how to obtain previous lines from text file?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 09:10:00
问题 I have a text file containing hundreds of lines of text containing database info. I'm trying to extract the DatabaseId s for any database which is 35GB. I would like to interrogate the file using Powershell and produce a text file containing all the matching databases. So in essence, I would like to scan through the file, find a DatabaseSize which is 35 and then extract the corresponding DatabaseId from 3 lines previous. I've looked all over the net but can't seem to find anything which can