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

Creating a script that has next page unix bash

I have 10 text files with me that I plan on displaying as an output simulating a manual page on how a user could use my script. However I'm looking for the most optimal way in going about displaying the 10 pages page per page. In example: If a user…
0
votes
1 answer

R: Want to check if any element of a set of words appear in a certain string

Assuming I have a dataframe called items, and the first column is ItemNames. I'd like to go through each item in in items$ItemNames and check if they contain any of these words in: words = c("apple","Apple","Pear","pear") and if they do, replace the…
Qonl
  • 79
  • 1
  • 10
0
votes
2 answers

Search an replace text in column for Column Type Text SQL Server

What I need is to search for a string in a specific column (datatype: text) of a table and replace it with another text. For example Id | Text ----------------------------- 1 this is test 2 that…
Pabuc
  • 5,528
  • 7
  • 37
  • 52
0
votes
1 answer

Quick way to add hundreds of items to an XML element

I have to add up to 100 .png's to create an AnimationDrawable on Android. Luckily, the png's are named in ascending order (p1, p2, p3, p4). Manually adding all pngs into the XML element is painfully slow, so I'm wondering if there's a way to…
0
votes
3 answers

Integer.valueOf() Error ArrayIndexOutOfBoundsException:

String currentLine = reader.readLine(); while (currentLine != null) { String[] studentDetail = currentLine.split(""); String name = studentDetail[0]; int number = Integer.valueOf(studentDetail[1]); currentLine = reader.readLine(); } So I…
Camila
  • 1
  • 3
0
votes
1 answer

How to iterate through a list and add the contents to a file

and good day fellow developers. I was wondering if say i would like to append every thing on list to a text file but. i want it to look like this list = ['something','foo','foooo','bar','bur','baar'] #the list THE NORMAL FILE this is the…
Skrmnghrd
  • 558
  • 4
  • 10
0
votes
1 answer

How do I write a MATLAB code that edits another MATLAB file (.m)?

I have two files, Editor.m and Parameters.m. I want to write a code in Editor.m that when run does the following task: reads Parameters.m searches for a line in it (e.g. dt=1) replaces it with something else (e.g. dt=0.6) saves Parameters.m. So,…
odnerpmocon
  • 282
  • 1
  • 4
  • 17
0
votes
2 answers

How can I split a text file line by line into 2 text files by delimited column?

I've tried various combinations of the following: awk -F" ||| " '{$0=$1}1' source_file.txt > column1.txt awk -F" ||| " '{$0=$1}2' source_file.txt > column2.txt or awk 'BEGIN {FS=" ||| ";}{print $1}' source_file.txt > column1.txt awk 'BEGIN {FS="…
Ryan
  • 14,682
  • 32
  • 106
  • 179
0
votes
0 answers

A way to extract patterns from text

I have a big array of data coming from external aggregating system. The data part that is related to my question is array of strings. Examples (not real ones but quite illustrative): Model: TOYOTA COROLLA VIN: ABC123 Year: 2012 Color: Black White…
v.karbovnichy
  • 3,183
  • 2
  • 36
  • 47
0
votes
1 answer

text manipulation using unix commands only

I have a task where I need to parse through files and extract information. I can do this easy using bash but I have to get it done through unix commands only. For example, I have a file similar to the following: Setonetwothree …
basil
  • 690
  • 2
  • 11
  • 30
0
votes
1 answer

How to extract values from a text file using a script?

If I have a file with the contents as below: field1=value1,field2=value2,field3=value3,field4=value4,field5=value5,..;(new line) field1=value1.1,field2=value1.2,field3=value1.3,field4=value1.4,field5=value1.5,...; (new line) ..... .... ... Each…
Liju Thomas
  • 1,054
  • 5
  • 18
  • 25
0
votes
3 answers

Python - Comparing files delimiting characters in line

there. I'm a begginer in python and I'm struggling to do the following: I have a file like this (+10k line): EgrG_000095700 /product="ubiquitin carboxyl terminal hydrolase 5" EgrG_000095800 /product="DNA polymerase epsilon subunit 3" EgrG_000095850…
0
votes
2 answers

bash: add column every n seconds

I got output like that: 0.000 0.002 0.000 0.002 0.000 0.026 ===== 0.026 Note, how the last line (0.026) is the endtime of the phases before. I will repeat that command every n seconds and I want that the next output is written to the next column…
JMAD2016
  • 111
  • 1
  • 2
  • 9
0
votes
2 answers

Text insertion using Ruby

I have a .txt file with text laid out like this: 11/14/2015, 13:51: John Doe: Hi there 11/14/2015, 13:52: Jane Doe: Hi, my name is Jane. Nice to meet you. 11/14/2015, 13:53: Joe Bloggs: Hey there everyone! Shall we get started? What I'd like to…
0
votes
0 answers

Ruby program not reading through all lines of a text file

I have a text file with a layout that looks like this: 2014-10-12 21:30:49 Some text here... 2013-08-30 10:40:38 Some more text here... What the program aims to do is read through the file and change the format of the dates so that it would look…