» Home » lines » Page 1
How to wrap long lines in a text using Regular Expressions when you also need to indent the wrapped lines?
by Olympian Last in Programming Languages

How can one change the following text

The quick brown fox jumps over the lazy dog.


The quick brown fox +
jumps over the +
lazy dog.

using regex?


A solution for Ruby is still missing... A simple one I came to so far is

def textwrap text, width, indent="

python read lines of website source code 100 lines at a time
by sham63 in Development Tools & Services

I'm trying to read the source code from a website 100 lines at a time

For example:

self.code = urllib.request.urlopen(uri)
#Get 100 first lines
self.lines = self.getLines()
#Get 100 next lines
self.lines = self.getLines()

My getLines code is like this:

def getLines(self):
res = []
i = 0

Search files and when match is found, store it, then print out 4 lines above, 3 lines below
by rcpratt in Programming Languages

I have a simple search script that takes user input and searches across directories & files and just lists the files it is found in. What I want to do is to be able to is when a match is found, grab 4 lines above it, and 3 lines below it and print it. So, lets say I have.

"a;lskdj a;sdkjfa;klsjdf a aa;ksjd a;kjaf ;;jk;kj asdfjjasdjjfajsd jdjd

how to search for multiple lines in a file and comment those lines in bash/dash
by BSim500 in Operating Systems

I have a file with contents

abc dbw ;
xxx{ sample test }

I need to check for

xxx{ sample test }

and comment out these line like

/*xxx{ sample test }

I have tried with grep but grep searches fo

print lines between lines started with special character in shell scipting
by zclin in Programming Languages

I have a text file which is like:


I want to read this file and check the lines between lines started with "#". If the line is started with "#" then ignore it and if it is not started with "#" then redirect the whole line in another file.
thus the content of the file (new) should be at firs

Jfree chart XY plot : how can we set the space between horizontal lines to 0.3 and vertical lines to 0.4?
by Uppsala9496 in Web Design

Hi I am trying to set the space between horizontal grid lines of y axis to 0.3 and vertical grid lines of x axis to 0.4 in XY Plot.

I have tried setting the width and margins but,I see no difference in horizontal and vertical grid lines of xy plot.

please can u let me know how can we achieve it.


How to parallelize reading lines from an input file when lines get independently processed?
by okhomenko in Programming Languages

I just started off with OpenMP using C++. My serial code in C++ looks something like this:

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <fstream>
#include <stdlib.h>
int main(int argc, char* argv[]) {
string line;
std::ifstream inputfile(argv[1]);

PHP or Linux Shell: Fastest way to reduce a text file that has more than 10 lines to only have the last 10 lines
by cyclohexane in Programming Languages

I need to know the fastest way possible, in PHP or Linux Command Shell, to reduce a text file that has more than 10 lines to only have the last 10 lines. I want to use 10 lines for this example.

Thanks :)

Java: Parse about 700 lines of text, split the lines up and use them as variables?
by odunthorne in Development Tools & Services

Instead of having to go through 700-800 lines of text, each line being some variation of:


I have a method i have to pass each line to, which is anotherclass.setBlock(xCoord, yCoord, zCoord, id). So for the above example, it would be:

anotherclass.setBlock(x-5, y-8, 0, 2);

Is there any way to parse through every

How do I read single lines from data consisting of multiple lines in c#?
by Magic Carpet in C & C++ & C#

I need to process data inside a richtextbox to output to an exact range of cells and I need to process each line of data to a single cell.

The total amount of data is 52 lines in the richtextbox and I want each data (each line) placed in a single cell range (C17:C42,H17:H42)

I've already tried it with my code:

range = objSheet.get_Range("C17:C42,H17:H42",

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .