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
-1
votes
2 answers

Insert strings at multiple (but limited) matches in another string

I have this string in Javascript: text = "2222 22:22: John: New York /n last year and: the next year /n 3333 33:33: Jack: Los Angeles!!!" I want it to be the following: newText = "(xSep)2222 22:22:(zSep) John:(zSep) New York /n last year and: the…
Nano
  • 21
  • 3
-1
votes
1 answer

Ruby: What are the ways to handle a .txt file as template?

I got the following template: |Info1|Info2|Info3|Info4|Info5|Info6|Info7|Info8|Info9|Info10| |Info11|Info12|Info13|Info14|Info15|Info16|Info17|Info18|Info19|Info20| And I have to substitute each information with real data and put it into a .txt…
Eric Martins
  • 460
  • 4
  • 17
-1
votes
2 answers

Bash/python/perl magic to get aggregate datetimes across multiple log files

I have a directory (/home/myuser/logs) that contains the following log files for the last 5 days: applogs_20130402.txt applogs_20130401.txt applogs_20130331.txt applogs_20130330.txt Each line of every "applog" has the same structure, just different…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
-1
votes
4 answers

Replace text with regular expressions in a text editor

I need to edit lines in a text file. The text files contains more than 100 lines of data in the below format. Cosmos Rh Us (Paperback) $10.99 Shipped: The Good Earth (Paperback) $6.66 Shipped: BEST OF D.H. LAWRENCE (Paperback) $7.89…
user2434
  • 6,339
  • 18
  • 63
  • 87
-2
votes
1 answer

Return part of string between specific character pair, in string with multiple character pairs

Text file or string: SomeText1/SomeText2/SomeText3/SomeText4/SomeText5 #What I am looking for: split_func(3, "/") >>> SomeText3
Floxxy
  • 7
  • 3
-2
votes
1 answer

Cleaning text in python

I just started coding with python and I have a dataset where two of my columns are giving me some problems. One of them has the information of the country of origin of an artist, and some of them have dual nationalities, like so: France/America. I…
Alonso Ag
  • 87
  • 1
  • 8
-2
votes
2 answers

Regex to pull particular value from the field in Python

I have below type of components in jira.I am trying to create the regex to fetch the value from these components .This value could be anything e.g 1.1 or 1.a or a.a or nothing for any components but remember I don't need anything like R or (U1) just…
unknown
  • 1,815
  • 3
  • 26
  • 51
-2
votes
2 answers

PowerShell: Delete similar lines from file

Consider the file tbl.txt (1.5 million lines), built like: Num1 ; Num2 ; 'Value' ; 'Attribute' So tbl.txt looks like: 63 ; 193 ; 'Green' ; 'Color' 152 ; 162 ; 'Tall' ; 'Size' 230 ; 164 ; '130lbs' ; 'Weight' 249 ; 175 ; 'Green' ; 'Color' …
SamNorton
  • 29
  • 3
-2
votes
3 answers

Sed/awk text manipulation

How can I convert this : RS.PK.03.01.4200.03.014.01 to man03140101? What needs to be done? Text before 5th "." has to be removed : RS.PK.03.01.4200. The remaining text should be converted 03.014.01 should be converted to 031401 — "0" was…
supervirus
  • 97
  • 1
  • 3
  • 10
-3
votes
1 answer

Match string and print output specified field side by side for multiple files

I'm new to programming so I might need explanation for each step and I have an issue: Say I have these (tab delimited) files: genelist.txt contains: start_position end_position description 1 840 putative replication protein 1839 2030 …
-3
votes
1 answer

Replace a string with a different string every time it occurs

I have a text file with three occurrences of the string 'object'. There is an object on the table The object is under the chair There might be an object in my pocket I want to write a Perl script to replace every occurrence of 'object' with another…
-5
votes
1 answer

How to read txt file and save as a single string in java in order to split it by a certain character

I'm new to to java language & am finding trouble finding to: 1. read a txt file 2. save entire txt file as single string 3. once I have the txt file content as a string, break the string (by a certain character such as a new line) into an array of…
Clifford Fajardo
  • 1,357
  • 1
  • 17
  • 28
1 2 3
15
16