Programming :: Construct A Quick Regex That Will Search For Six Lines Of Text

Apr 25, 2011

I am trying to construct a quick regex that will search for six lines of text without a clear line break between them. It only needs to search, not replace, as I will be using in gEdit (with regex plugin) anyway.

It's for editing subtitle files. The video player I will be using them on can only cope with 3-line subtitles, so I just need to edit any in the srt file that contain four or more. There won't be many so I can do it manually. For example:

26
00:01:47,357 --> 00:01:49,359
a motivated business
professional with
clearly defined goals.

[Code].....

but .* seems to mean "any character, or none", so that doesn't work. My experience of regular expressions is limited, but I do know they are very powerful when used correctly!

View 10 Replies


ADVERTISEMENT

Programming :: Perl Regex Not Matching Across Multiple Lines Despite Ms Flags / Fix It?

Aug 16, 2010

I have written a regular expression (tested in regexpal and regextester alpha something) with which I want to replace something like code...

but it only matches functions which occupy one line only, despite my tests showing multiple line matching in javascript testers online and using the m and s flags (which should make it multi line no?)

View 14 Replies View Related

Ubuntu :: Text Editor Column Editor And Regex Search/replace, Incrementing Number Insert?

Jul 25, 2011

On windows I really only used Notepad++ as my text editor, it had two features that I loved.What I need to accomplish is what I would do with Notepad++ column editor.I could have like 100 lines, and place the cursor at a column, and goto edit>column editor, and I could insert an incrementing number. (I could also pad the incrementing number with 0s, this was GREAT for making batch files among other things.)So each line at that column had a number higher than the previous line.The other feature that I used sometimes was a search/replace with regex patterns.Does anyone know of an editor that has those features for linux? I am mostly after the column editor insert feature but if you know of one with both features that would rock.

View 1 Replies View Related

CentOS 5 :: Search A Text File For The Existence Of Certain Strings And Execute A Command If They Exist, Something Along The Lines?

Feb 23, 2010

This should be simple but I can't seem to find what I am looking for.I want to search a text file for the existence of certain strings and execute a command if they exist, something along the lines of:

if <string> exists
command
or

if <any member of this list exists>
command

I know how to manually search a file with grep, cat, etc., but the "if this exists" part eludes me.

View 7 Replies View Related

Programming :: Bash Text To Variable Accessing Individual Text Lines?

May 2, 2010

i am on processing text tasks And i found that if you assign a text to a variable is chomp'ed automatically the newline

Code:

variable=$(cat file.txt)

The problem is i can only access the items/lines using:

Code:

for line in $variable
do
echo $line
# Other commands
done

how do i convert this to an indexed array. More importantly, how do i get access to individual $line[0], ..., $line[n] Another thing, if the file.txt, has lines with spaces it is a mess using the for...in..., but echoing prints line by line...o_0

View 11 Replies View Related

Programming :: Adding Lines Of Text To Beginning Of Text File

Jan 19, 2009

I need to insert 3-4 lines of text to the beginning of a text file. The file is a largish MYSQL dump, the result of a backup shell script. This shell script should insert the required text.I've wrestled with sed, but lost.

View 2 Replies View Related

Programming :: Search File By Pattern And Then Delete Corresponding Lines In Shell?

Sep 16, 2010

I have such a file(test.txt):

abc 123 456
abc 256 145
axd 125 225

[code]...

View 8 Replies View Related

Programming :: Take A Int From 2 Lines Of Text?

Apr 20, 2011

I do a logcat, i got lot of lines, that I filter with a grep, at end, I just got some lines like this:

Code:
I/ActivityManager( 1763): Config changed: { scale=1.0 imsi=732/123 loc=es_ES touch=3 keys=2/1/2 nav=2/1 orien=1 layout=17 uiMode=17 seq=15}

[code]...

View 6 Replies View Related

Programming :: Add Comma To End Of Lines In Text File?

Aug 21, 2010

I have a plain text file with 360 lines of varying length text. How do I add a comma or other symbol to the end of each line so that I can convert the file to csv format that I can open in a spreadsheet (45 rows, 8 columns). That means each 8 lines of text forms 8 columns, with 45 rows.

View 9 Replies View Related

Programming :: Remove Lines In A Text File Based On Another Text File?

Jan 28, 2009

I have a text file called file1.txt containing many lines eg.

line1
line2
line3
line4
line5
line6

Then i have another text file called file2.txt contains

3
5
6

Is there a command to remove the lines in file1.txt based on the keywords in file2.txt? note: It should remove line3,line5,line6 based on 3,5,6

View 10 Replies View Related

Programming :: C++ Character Search In Text File?

Jun 23, 2011

Im trying to read a file in c++ and search for particular character for example if this is a list that I have:

Alice
Bob
David

[code]....

if the input is D, it should give David, if its B, gives bob. so in this case, meaning it reads the first character of every line. but if possible I want to make this dynamic so the user can specify which character position he is looking for, so in case he is looking for R as character index 3 in all lines, it should give Charlie. but the problem is, it does now recognize , besides, I do not know how to specify the character position in each line.

here is my code

Code:

#include <iostream>
#include <fstream>
#include <cstring>

[code]....

View 1 Replies View Related

Programming :: Text Editor With Search And Capture

Dec 6, 2010

i was wondering if in all the editors/tools in linux, if there was a prog that can extract a portion of a text file, giving it a starting line of say o as the first character on a line of say o35565 oxxxxx then when it finds the next line down the file with the same thing oxxxxwhatever

it could take those lines and all the lines between them and save it to another file? i dont know if you call this parsing? or what.

View 14 Replies View Related

Programming :: Read Multiple Lines From A Text File?

Mar 11, 2011

For example, I have a text file with data which lists numerical values from two separate individuals

Code:
Person A
100

[code]...

View 1 Replies View Related

Programming :: Script To Break A Block Of Text On To Different Lines?

Dec 15, 2010

I have a clump of text that needs to be broke up:gdbm Sat 07 Feb 2009 03:28:18 AM EST libattr Sat 07 Feb 2009 03:28:18 AM EST db4 Sat 07 Feb 2009 03:28:19 AM EST mktemp Sat 07 Feb 2009 03:28:19 AM EST keyutils Sat 07 Feb 2009 03:28:20 AM EST pcre Sat 07 Feb 2009 03:28:21 AM EST setserial Sat 07 Feb 2009 03:28:24 AM EST zlib Sat 07 Feb 2009 03:28:24 AM EST gawk Sat 07 Feb 2009 03:28:25 AM EST readline Sat 07 Feb 2009 03:28:26 AM EST rhpl Sat 07 Feb 2009 03:28:28 AM EST cracklib-dicts Sat 07 Feb 2009 03:28:37 AM EST setools Sat 07 Feb 2009 03:28:37 AM EST hal Sat 07 Feb 2009 03:28:38 AM EST which Sat 07 Feb 2009 03:28:39 AM EST Is there a way to get everything after the EDT in the text to be moved to a new line?

View 13 Replies View Related

Programming :: String Search In Text File Using Visual C++

Jan 25, 2010

im tryin to make a tool in visual C++ which will take an input string through a text box,then it will compare tht string with a text file containing data and display the matched results in list box.

View 2 Replies View Related

Fedora :: Add A Folder To The Overview For Quick Search?

Jun 4, 2011

Assume that I've got a folder called "Stuffs". So in fedora 15 you don't have a desktop folder, I mean you can't use it like we were used to. Even if you activate the option that allows you to use the "desktop", it is very uncomfortable because you can't minimize windows quickly. So my question is: Is there a way of put a "Link" in the overview, so I can get in to the overview and write "Stuffs" in the search bar and get my "Stuffs" folder open ?

View 2 Replies View Related

Ubuntu :: Removing Yahoo Quick Search From FF

Apr 8, 2010

How do I accomplish this?

View 6 Replies View Related

Programming :: (BASH) How To Read Multiple Lines From Text File

Mar 11, 2011

For example, I have a text file with data which lists numerical values from two separate individuals

Code:
Person A
100
200
300
400
500
600
700
800
900
1000
1100
1200

Person B
1200
1100
1000
900
800
700
600
500
400
300
200
100

How would I go about reading the values for each Person, then being able to perform mathematical equations for each Person (finding the sum for example)?

View 13 Replies View Related

Ubuntu :: Synaptic Quick Search Doesn't Work?

Jun 7, 2010

I just upgraded my computer to Ubuntu 10.04 Lucid. Whenever I open Synaptic Package Manager it opens normally. If I type into the "Quick search" box, when I try to type in a word as soon as I type the second letter Synaptic immediately closes. However, if I click on the full "Search" button, this function works as it should. I just can't use Quick Search. Synaptic closes every time.

I uninstalled synaptic from a terminal by typing [CODE] apt-get remove synaptic. Then I reinstalled using [CODE] apt-get install synaptic. Reinstalling did not fix the problem. Does anyone have an idea how to fix this?

View 5 Replies View Related

Programming :: Sed One-liner: Search Text In File And Replace It - If Not Present Insert It?

Oct 16, 2010

As indicated in the subject, I want to search a text. If the text is present I want to replace it. But if the text is not present, I want to insert it after first line and before last line.

Searched text is:CleanCache "*";

Where * can be anything.

Example: CleanCache "false"; -> CleanCache "true";

If CleanCache "false"; is not present, only insert CleanCache "true"; after first line and before last line.

View 8 Replies View Related

General :: Emacs - Search And Replace Regex In Multiple Buffers?

Apr 7, 2009

I'm fairly comfortable with emacs but I can't seem to find how to do this. I deal with a lot of text files and find myself performing a lot of regular expression replacements to correct the formatting of the text -- or to extract certain tidbits of data from large ugly-looking files.

I know how to perform a regular expression replacement in one buffer at a time. But how do you perform a regular expression search and replace across all open buffers? I have found a method to perform a regex search and replace across a directory by marking files but I need to do it in the open buffers.

View 2 Replies View Related

Programming :: Write A Utility Which Will Scan In A Text File And Search And Replace Strings?

Jul 16, 2010

Something very handy to do in a Linux shell, is manipulating files and strings - essentially parsing data. Write a utility which will scan in a text file and search and replace strings. We also want to keep track of how many strings we've replaced.

I know that my command would look like this: <utility name> <filename> <stringToSearchFor> <stringToReplaceWith>
Code: #!/bin/bash

[code]....

View 2 Replies View Related

Programming :: Understanding This Construct In Javascript?

Dec 3, 2010

var param = function() { <whatever> } ;What exactly does the above MEAN, and why have they included this in the language this way?

View 6 Replies View Related

Ubuntu :: Text Manipulation - Regex - Pattern Matching?

Jul 12, 2010

Are there some good tutorials or reference materials on how do pattern matching and text manipulation in Linux?I have a few simple tasks I'd like taken care of...like formatting numbers in file names, stripping some text from directory names, etc

View 2 Replies View Related

Programming :: Search A File For A Particular Pattern And If Pattern Found Replace The Line With New Text?

Feb 24, 2010

I want to search a file for a particular pattern and if pattern found replace the line with new text. i am using awk 'match($0,"pattern") != 0 {print $0} ' filename to check if the pattern exists.how do i get the line number of the pattern and delete that line and replace the line with my new text?

View 1 Replies View Related

Programming :: Removing Left Recursion - Construct An AST From It By Executing A Piece Of Code For Every Nonterminal Matched?

Apr 7, 2011

I'm still a but confused about the standard way of removing it for left-associative operators: [URL] Especially about how to construct an AST from it by executing a peice of code for every nonterminal matched. And I'm still not totally convinced that it will be left-associative, I just barely understand it. Also, how would you remove left-recursion for something like this:

Code:
expr ::= expr "(" param_list ")"
| other stuff...?

View 8 Replies View Related

General :: Search Text In All Text Files Of All The Sub-directories?

Apr 21, 2010

Currently, when I'm searching text in files of my PHP project, I use this line :

Code:

grep -r 'myTextToFind' *

But now, I would like to search only in ".lang" files. How can I do that ?

View 7 Replies View Related

General :: Command Line - Print A Group Of Text Matching A Regex?

Sep 22, 2011

I'd like to print only few groups from text matching a regex. How can I do that in the Linux command line?

What other tools for text processing are there in Linux?

View 3 Replies View Related

General :: Search For Blank Lines With Awk?

Nov 2, 2009

I'm trying to make a program to search for each blank line in a text archive, where blocks are separated by this blank lines. I want to write the number of the line in a new file "numblank.txt" I have this, but I think I have a problem with the "blank line" simbol.

awk '{if ($1 == /^$/) print NR }' $file1 >! numblank.tmp

where file1 is given as:

text
text
text

[code]...

View 5 Replies View Related

Programming :: Remove Lines And Parts Of Lines From Python Strings?

Nov 24, 2009

How do you remove parts of strings using python? Such as, if I have something like:

Code:
erme1 sdifskenklsd
erme2 sdfjksliel

[code]....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved