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

How can one change the following text


The quick brown fox jumps over the lazy dog.

to


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

using regex?


UPDATE1

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


def textwrap text, width, indent="
"

View Replies


python read lines of website source code 100 lines at a time
Category : 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

View Replies


Jfree chart XY plot : how can we set the space between horizontal lines to 0.3 and vertical lines to 0.4?
Category : 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.


thanks.


View Replies


print lines between lines started with special character in shell scipting
Category : Programming Languages

I have a text file which is like:


#aabc
ld
#ac
bc
acz
c
#hello

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


View Replies


PHP or Linux Shell: Fastest way to reduce a text file that has more than 10 lines to only have the last 10 lines
Category : 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 :)


View Replies


Search files and when match is found, store it, then print out 4 lines above, 3 lines below
Category : 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.


somefile.html
"a;lskdj a;sdkjfa;klsjdf a aa;ksjd a;kjaf ;;jk;kj asdfjjasdjjfajsd jdjd
jdjajsdf

View Replies


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

I have a file with contents


abc dbw ;
xxx{ sample test }
bewolf
bewolf
test

I need to check for


xxx{ sample test }
bewolf

and comment out these line like


/*xxx{ sample test }
bewolf*/

I have tried with grep but grep searches fo


View Replies


How to parallelize reading lines from an input file when lines get independently processed?
Category : 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]);
if

View Replies


How can I print all the lines between the previous and next empty lines when a match is found?
Category : Programming Languages

I've racked my brain trying to come with a solution but in vain. Any guidance would be appreciated.


_data_
mascot
friend
ocean
parsimon
**QUERY**
apple
jujube
apricot
maple
**QUERY**
rose
mahonia

....Given the search keyword is QUERY, it would output:


parsimon
**QUERY**
appl

View Replies


How do I read single lines from data consisting of multiple lines in c#?
Category : 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",

View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .