Questions tagged [string-manipulation]
The string-manipulation tag has no usage guidance.
114
questions
1
vote
3
answers
675
views
How to strip suffix with basename inside a find -exec command?
I have not found a way to do the following example with find:
$ find . -name "*.mp3" -exec echo $(basename "{}" ".mp3") \;
I expected the basename command to remove ...
0
votes
1
answer
32
views
Split readings data into multiple lines
I have a text file containing data about the correspondence of readings and characters in the following style (not actual data, but exactly the same style):
yī 一伊依医
yí 乁仪侇仪冝凒
yǐ 乙以佁侜倚偯尻崺已
yì 乂义
I ...
1
vote
0
answers
146
views
Sublime Text 4 sql highlight inside a string
Currently, if I have sql commands inside a python string, Sublime Text highlights it. However if it's an "f string", it does not recognize the sql inside. Is there any way to make it work ...
1
vote
1
answer
247
views
Function to calculate length of a string in Google Spreadsheets when the string contains certain UTF-8 characters
This function returns 6 and it's expected to return 4:
=LEN("🥎A🥎B")
What function should I use to get the "real char count" expecting that one symbol in the UTF-8 icon map is 1 ...
0
votes
0
answers
61
views
How to fill a column getting a substring of another one with a rule
I'm trying to play with the functions LEFT, RIGHT and SEARCH to fill a column with the name of a function extracted from another column, but I don't get any good result.
I have a list of functions ...
1
vote
1
answer
192
views
Check string with negative decimal values contains special characters
I need to check if a string with negative values contains special characters. When I type -7.!, -7.@, -7.# the special characters are found, the error message is sent and the program is closed, but ...
2
votes
1
answer
886
views
Bash or zsh conditional patterns and variable expansions
Suppose I want to generate a filename based on some given variables.
track=01
title="Some title"
album="Some album"
echo ${track}. ${title} (${album})
-> 01. Some title (Some ...
3
votes
1
answer
2k
views
Powershell: Using .Split on Filename functioning differently based on filename capitalization
I have a bunch of image files that accidentally got renamed with a "doubled" file extension (e.g. IMG_1469.jpg.jpg). I wrote a script to remove the extra file extension, but for some reason, ...
0
votes
1
answer
1k
views
How do I delete text between 2 strings?
I have tried the regex expression .a href.*?..a. and .a href[^:]++..a.
I want to replace .a href=.u.gogogo98. class=.3t5uN8xUmg0TOwRCOGQEcU rel=noopener nofollow ugc target=.blank..u.gogogo98..a. with ...
0
votes
2
answers
715
views
Notepad ++ / Extract text betwen ^ ^ and add it, as new line
I have a text file that I need to extract specific data elements from it ( the person fullname to add it as new line):
ID:363712^CLARK/DEJA G^:e30276c2f826febd3784958:KZxhnbUUouxvMrTEYfGnDZ7YcGjPh
ID:...
2
votes
2
answers
6k
views
Batch - Extract string before the specified character
How to get the string before the character hyphen? The following code gets the string after the hyphen. How can I reverse this?
set string=1.0.10-SNAPSHOT
echo %string:*-=%
SNAPSHOT
But I want the ...
0
votes
1
answer
91
views
How to increment group numbers in a settings file?
I have an application with a settings file (.ini) that contains data in the common format:
[group1]
foo=bar
bar=baz
...
[group2]
foo=bar
bar=baz
...
...
[group500]
foo=bar
bar=baz
...
where the ...
1
vote
3
answers
6k
views
Windows command dir lists files with absolute path, relative path required
I would like to list all filesnames of all files with a specific extension in a directory structure and write this to a file. What I have reached:
dir /B /S *.ext > list.filenames
This gives me a ...
0
votes
1
answer
356
views
Excel: Extract a project number from a text string (various position and length)
In an Excel spreadsheet I have a column of mixed text strings containing project master data (type, project no., address, theme and such). From this string I need to extract the project number in an ...
3
votes
1
answer
1k
views
Remove spaces from first column of colon-delimited file
I have a very large colon-delimited file with two columns:
dhsj fdksjdk:dndkdlkfkd
shfdosod dkjsosjd:dkj dosjeod
dhswisoaidodisbw: dhsoi wjdos
fjfdododjfideefkjso sn:fhfdkd dkdjdf
If the first ...