Questions tagged [text-manipulation]

Text/String manipulation is the term used to describe various operations applied to strings and/or text.

Text/String manipulation is the term used to describe various operations applied to strings and/or text. Often used with Regex or replace functions, concatination, etc.

237 questions
2
votes
1 answer

String-length in the M4 preprocessor

So, with this simple input, define(foo, len($1)) foo(abcdef) I get, as output: 2 How can I get this to print 5, instead? I can't figure out any combination of quoting that makes len() actually receive the value of $1, abcdef, instead of the…
ELLIOTTCABLE
  • 17,185
  • 12
  • 62
  • 78
2
votes
2 answers

Text Replacement -- Pattern is a set list of strings [r]

I have a string variable in a large data set that I want to cleanse based on a set list of strings. ex. pattern <- c("dog","cat") but my list will be about 400 elements long. vector_to_clean == a black Dog white dOG doggie black CAT thatdamcat Then…
Kara_F
  • 163
  • 8
2
votes
2 answers

Text Manipulation Split Classes in a Single File into mulitple Files

I used XSD.EXE to to generate a C# files from an XSD schema. Unfortunately, this tool extracts all the classes into a single allClasses.cs file. Has anyone got a good technique(or tool) that will extract each of the classes in the allClasses.cs…
guazz
  • 81
  • 1
2
votes
2 answers

Remove Markdown tags from string

I have a string which has Markdown tags embedded inside it. I do not want to encode the Markdown as anything else, I just want to rip out all of the tags. How can I do this quickly? I need to do this as part of a batch processing job which…
Faraday
  • 2,904
  • 3
  • 23
  • 46
2
votes
2 answers

bullet points in Access 2010 Report

I'm working on changing an Access 2010 report. There is a portion of the report that reads in Raw Data from a SharePoint field called "Notes" that has comments for each record. Within the "notes" field, there can be several sentences. I need to…
AnalyzeThis
  • 61
  • 1
  • 8
2
votes
2 answers

How to convert text file automatically to graphviz dot file?

I am trying to convert my text file to an undirected graph automatically with the help of graphviz. The text file consists of the following code: 0 A Relation B A Relation C B Relation C 1 0 A Relation C B Relation C 1 Here A, B and C are…
abhisekG
  • 426
  • 2
  • 5
  • 16
2
votes
3 answers

How can I automatically calculate and change numbers in a text file (Java class)?

Suppose I have an enum class like the one from Oracle’s example: public enum Planet { MERCURY (3.303e+23, 2.4397e6), VENUS (4.869e+24, 6.0518e6), EARTH (5.976e+24, 6.37814e6), MARS (6.421e+23, 3.3972e6), JUPITER (1.9e+27, …
Dave's tux
  • 123
  • 2
2
votes
5 answers

Remove last line from multi-lined variable

How can I remove the few lines from a multi-lined variable? I'm getting this sort of stuff back from Expect and need to neaten it up a little bit $var=' total 20 drwxr-xr-x 5 drew.jess users 4096 2013-01-22 15:51 bash drwxr-xr-x 2 drew.jess users…
drew
  • 21
  • 1
  • 5
2
votes
4 answers

How can I remove all characters in each line after the first space in a text file?

I have a large log file from which I need to extract file names. The file looks like this: /path/to/loremIpsumDolor.sit /more/text/here/notAlways/theSame/here /path/to/anotherFile.ext /more/text/here/differentText/here .... about 10 million times I…
Ryan
  • 14,682
  • 32
  • 106
  • 179
2
votes
3 answers

Text manipulation of strings containing "The "

I have a table in a MySQL database which contains data like this; ID text 1 Action Jackson 2 The impaler 3 The chubby conquistador 4 Cornholer I want to display them in alphabetical order minus the leading "The ". This is what I've come up…
Gregology
  • 1,625
  • 2
  • 18
  • 32
2
votes
1 answer

Batch: Reordering numbers in a text file

I have a .txt file that contains a list of menu's and commands. What I want to be able to do is incrementally run through each line of this .txt file, check the number, and increment it from the previous value. So, here is an example section of…
Stoating
  • 411
  • 3
  • 6
  • 12
1
vote
1 answer

How to remove multi-line blocks of text of varying sizes from a file given the first and last lines and a substring?

I have an xml file listing several games and their metadata, like so: ./Besiege.desktop Besiege Long description of game
Calibre
  • 13
  • 5
1
vote
4 answers

Given a logfile.txt, I want to extract the java script name only; e.g. filename.js using a bash script

I use following awk script to do so, for line in $1 do grep -F ".js" $1 | awk '{print $7}' | sort -u done the out put is almost…
1
vote
4 answers

How can I select a string by reading a field name and use it to place it in a different field in bash?

I have a huge text file (thousands of lines) containing chuncks of information (previously filtered) which are separated by an empty line. Example with a few of them: Name: CAR 8:1 Precursor type: [M]+ Formula: C15H28NO4 Num Peaks: 2 85.02841…
1
vote
0 answers

Remove all texts until certain string in multiple text files using python

I have 14680 text files and after certain String I want to delete all the lines in each text files, how to accomplish this using python Thanks and Regards