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
vote
3 answers

How to manipulate text in PHP to have single quote and coma

My question must be simple but I can't figure how to do that: $input = "Hello, Beautiful, World"; and $expected_output = "'Hello','Beautiful','World'"; I know I can split text by explode(" ", $input); but how to join with ', ? Why I need it? I…
Tikky
  • 1,253
  • 2
  • 17
  • 36
1
vote
4 answers

Exiting an AWK statement after printing a block of text

My problem is that I have a very large database (10GB) and I want to save as much time as possible searching through it. I have an awk statement that is searching through the database and depending on the pattern, writes the data into another…
Justin
  • 11
  • 7
1
vote
3 answers

Add double quotes around all the fields in CSV file

I want to add quotes in all the fields of the CSV file. My CSV file $ cat file.csv 1,563,45645,example-text,/example/path,FILE,ftp://,11 Expected output $ cat file.csv "1","563","45645","example-text","/example/path","FILE","ftp://","11"
smc
  • 2,175
  • 3
  • 17
  • 30
1
vote
1 answer

Retriving the value of a registry string in a batch script

In a batch file, I'm reading the value of 'ProfileImagePath' like so... for /f "delims=" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%thisusersid%" /v ProfileImagePath') do set…
John
  • 755
  • 1
  • 18
  • 46
1
vote
1 answer

bash - filter IP in file by time

I need complete the program "wana" to filter this IP log by time (-a > after , -b > before >> time from-to) to show rows only in specified time datetime format: YYYY-MM-DD HH:MM:SS to parameters -a and -b This is my file with logs, i use :…
Xipcz1
  • 13
  • 3
1
vote
2 answers

How do I chunk the records in SQL Server 2005?

lets say i have a column Name in tableA Name jennifer Hughs Mike nadrotosky Arnold Woods Raj Jai Soni so how do i put these results in seperate 3 columns like FirstName MiddleName LastName Jennifer Hughs . . . Raj Jai …
Programmer
  • 129
  • 3
  • 10
1
vote
1 answer

How to Increment timestamps in text file

I am comparing two long log files which are exactly the same except for the timestamp. Eg: Log1 fn1-start 11:10:10 fn2-start 11:10:12 fn2-end 11:10:19 fn1-end 11:11:20 ... A long list ... Log 2 fn1-start 11:22:11 fn2-start 11:22:13 fn2-end …
El-Kal
  • 11
  • 3
1
vote
1 answer

Checking if values in a specific column are the same in the same column for the line below?

I am looking for a Linux command in which I can compare if, for a single column, the line below is the same value as the line currently being checked, and if they are then output both lines. My file is tab separated. Input example: line 1 1 …
user9861194
1
vote
0 answers

How do I manipulate an unstructured text data using stringr?

I have an unstructured data which I hope to manipulate it so that it becomes a data that is usable for analysis. The following is my dataframe which contains 97 observations and 5 variables, namely, DRUG_NAME, DRUG_STRENGTH_NO, DRUG_STRENGTH_UNIT,…
HNSKD
  • 1,614
  • 2
  • 14
  • 25
1
vote
2 answers

How do I split strings into number and the remaining string using stringr in r?

I would like to split strings in my dataframe using stringr. The following is my dataframe: df<-data.frame(ID = 1:26, DRUG_STRENGTH = c("50 MG", "1250 MG", "20 MG", "200 MG", "2MG", "60MG", NA, "300IU", NA,…
HNSKD
  • 1,614
  • 2
  • 14
  • 25
1
vote
2 answers

R: Identify and remove columns with invalid column names

Is there a way to identify invalid column names in R? perhaps using a regular expression or another technique. I am generating a DocumentTermMatrix (DTM) from text column and then convert this DTM to a data frame. I end up with columns with invalid…
zunman
  • 108
  • 1
  • 11
1
vote
1 answer

Print match and line after match

I have this file containing 82 pairs of IDs: EmuJ_000063620.1 EgrG_000063620.1 253 253 EmuJ_000065200.1 EgrG_000065200.1 128 128 EmuJ_000081200.1 EgrG_000081200.1 1213 1213 EmuJ_000096200.1 EgrG_000096200.1 295…
1
vote
1 answer

Array text manipulation

So, I've managed to populate an array with the names of directories, what i need to do now is remove certain parts of the directory names. this is what most of my array look like F:\Users\Killu\AppData\Local\osu!\Songs\82734 Sakakibara Yui -…
louis kemp
  • 11
  • 1
1
vote
0 answers

N-gram analysis based on impression in R

This is my sample dataset: library(dplyr) query <- c("how to feed a dog","dog common diseases and how to treat them ","dog habits","dog versus cat","cat bite","cat diseases and how to treat them") impression <-…
Ran Tao
  • 311
  • 1
  • 4
  • 13
1
vote
1 answer

Multiple-line collapse in Notepad++

I want to use notepad++ to do multiple-line collapse. What I mean is that I am looking for a simple operation to turn 1 2 3 4 into 1 2 3 4
splinter
  • 3,727
  • 8
  • 37
  • 82