Questions tagged [string-manipulation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
88 views

Excel - How to split a string by a list of delimiters

As part of a board game logging tool, I want to be able to split a string. The string may consist of the following: Allowed characters: 00,0,1,2,3,4,5,6,C,B,R. Besides 00, any numbers will always be ...
0
votes
1answer
101 views

Best way to store multiple values from a running process into variables in bash

The problem Starting a process will output sensitive information on the bash. I want to extract this value of an occuring pattern and assign it to bash variables. In concrete, starting the process ...
2
votes
1answer
199 views

In convert case, what is the difference between blend and normal version?

In notepad++, if you go to Edit > Convert Case to, you have entries like: Proper Case Proper Case (blend) Sentence case Sentence case (blend) What is the difference between blend and "normal" ...
0
votes
0answers
48 views

replacing all lines between two patterns in MacOS sed

I'm a bit struggling with sed and would love someone to help... I'm after replacing all lines between two patterns(foo,bar) inclusive) with the text REPLACEMENT. sed -n '/foo/{:a;N;/bar/!ba;N;s/.*\...
3
votes
1answer
129 views

How does this find state actually work in moving a file up one directory?

Can someone explain how the string manipulation in this find statement actually works? My head is about to explode trying to figure it out. :-o From: UNIX shell scripting: how to recursively move ...
3
votes
1answer
113 views

joining lines while adding white-spaces to select strings in CMD does not always work

here is an ordinary .bat that joins all lines and leaves a whitespace between the resulting strings. @echo off setlocal EnableDelayedExpansion set row= @For /F "EOL=|" %%x In ('^""%__AppDir__%find....
0
votes
1answer
267 views

In Bash how to get the position of a substring, within a string, starting the search at character position n

I am new to Bash scripting, I've used Visual Basic in Windows before and am looking for a bash equivalent string function for VB's inStr(). example in VB : strMain = "abcABC123ABCabc" searchStartPos ...
1
vote
3answers
156 views

How to extract a part of a line that is between two specific strings via a batch script

I am trying to extract strings which are between testid= and ]. Input text file SEVERE TEST 11/18/2019 8:00:41 AM Could not find INPUT with [testid=2345] SEVERE TEST 11/18/2019 5:02:11 AM Could ...
1
vote
1answer
89 views

replace sub-string with last special character, being (3rd part) of comma separated string

I have a string with comma separated values, like: 742108,SOME-STRING_A_-BLAHBLAH_1-4MP0RTTYE,SOME-STRING_A_-BLAHBLAH_1-4MP0-,,, As you can see, the 3rd comma separated value has sometimes special ...
1
vote
1answer
15 views

How to format Excel cells to show only a certain part of the code my scanner scans from certain objects?

For ex: When I scan an qr code it shows: Column A1 vbmsavchjas asdhgaskhdgaskhdg_INX7642854858625 but I am only interest in the last characters: Column B1 INX7642854858625 I can use afterwards in ...
1
vote
2answers
100 views

how to split a string in two then assign each segment into a variable

I have this code: #!/bin/sh echo "--------- Backup config files -------------" find /vmfs/volumes/datastore1/ \ -type f \ -regex '.*\.\(vmx\|nvram\|vmsd\|vmdk\)$' \ ! -name '*-flat.vmdk' \ -...
3
votes
1answer
514 views

Use find and do command on filename without “./” prefix

Performing a cp on filenames in multiple subdirectories and prefix them with foo- leads to an error: $ find my-dir -path "*/*" -execdir sh -c 'cp {} foo-{}' \; cannot create regular file ‘foo-./...
0
votes
2answers
752 views

How to reverse a string in Excel?

Is there an Excel function (or macro) I can use to reverse a string. i.e. to turn these words into sdrow eseht? Here is why I need that: My strings are similar to John|XYZ Street|215|USA and I need ...
2
votes
1answer
81 views

sed: match a string between two different consecutive matches on all occurrencies

i have: bananaOPENqwertyCLOSErandomtextOPENgrapesCLOSEwhateverOPENsunshineCLOSEgreymoon this line could have many more OPEN and CLOSE strings in it. I want to print the whole line with only ...
0
votes
1answer
47 views

How to add 'filler' characters up to N limit to a variable length string using Excel / Sheets formulae?

I have a list of strings (names / description text) that I need to add 'filler' characters to. The maximum string length is 32 - for any text under that (in characters) I need to add special filler ...
1
vote
1answer
74 views

Surround certain string with specified characters using regex-capable editor

I need to format certain string in Sphinx's documentation H2 Header. Example: v-add-user should be replaced with ********* v-add-user ********* I search for needed string in Notepad++ (regex ^(...
2
votes
2answers
223 views

How to remove extension from pathname passed as {} in `find -exec`?

Given the situation that audio needs to be extracted from video files residing in subdirectories, how would one go about properly naming the resulting files? The following one-liner works, but ...
0
votes
1answer
36 views

`tr` replaces more than I expected

I have a load of files from my teaching job that I want to put in OneDrive on a regular backup. My colleagues are bad at naming files, so they need a cleanup for OneDrive to take them. The bit that ...
0
votes
0answers
488 views

Recursive and massive string replace inside Windows folder

I have a text file with oldstr<tab>newstring lines to replace inside all source files like this: MyOldText (tab) MyNewText MyOldText2 (tab) MyNewText2 How can I massively replace ...
0
votes
2answers
42 views

How can I insert the original matched pattern (OLD STRING) into the result (NEW STRING) Using Microsoft Word's Find/Replace Feature?

Microsoft Word's find/replace feature seems like it is many-to-one. Suppose that we have a word document numbers surrounded by parentheses, such as (6) and we want to remove the parentheses and place ...
0
votes
1answer
234 views

Busybox filter string list

Consider I have a list like this: list='item1.service item2.service item3.target item4.service' I need to filter this list to get something as: item1 item2 item4 So, there are two things to notice:...
1
vote
1answer
49 views

Extracting filenames from svn console output

My Tortoise SVN SVN update command generally returns me this output: C:\proj>svn update Updating '.': A 'some-file1.txt' D 'some-file2.txt' Restored 'some-file3.txt' U 'some'file4.txt' C 'some ...
1
vote
1answer
38 views

How to extract multiple urls from String?

I have a string like below https://website.com/BTAE/2015/BTAE assignment jan 15.pdf²0ÔË'\„QI„"ÙP¾^ŒŸZ‡@Æ*]Ü.^‚vðƒ€Ù¾»Æš©Šñ‘€é• ªÂIR#œÉgÉÛ^gMdÉ%9¬e˜Hžôb¿'0<ô ?lþzk…éÃÄórÈ;EW¦K³1…²ì¶ZFžŠÒô*ÄÖ\...
0
votes
1answer
90 views

Editing strings that are followed by a punctuation mark in Microsoft Word [closed]

I have a Microsoft Word document with two sections of text. The first is in paragraph form, the second is that paragraph form broken down into segments and placed in a table without punctuation. Is ...
2
votes
4answers
3k views

Linux command to remove the duplicate lines but keep the first occurrence

I have a text file. Each line contains a string. Some strings are repeated. I want to remove repetition but I want to keep the first occurrence. For example: line1 line1 line2 line3 line4 line3 line5 ...
1
vote
4answers
1k views

How to get string between the last two “/” symbols

I am using Bash. I have some string of paths, like /dir0/dir1/dir2/filename.ext and I want to extract the string dir2 in bash. You can assume that the word I want to extract is located between the two ...
0
votes
1answer
639 views

How to split single row CSV?

I have a CSV file that imports like this: Field1_Entry1,Field2_Entry1,...FieldN_Entry1,Field1_Entry2,Field2_Entry2... I intend to have a new row after Field N so I get a table with N columns: ...
6
votes
1answer
1k views

Replace every 6th pipe in powershell

I realize I'm asking a similar question that was already asked and answered but I was not able to extrapolate the answer I needed since the regex and regex engine is different enough. I have hardware ...
1
vote
3answers
4k views

bash - Find difference between two variables

I have two variables: var1="1, 2, 3, 4" and var2="3, 4, 5, 6". I'd like to get a new one, var3, containing the differences between $var1 and $var2. The expected result should be var3=1, 2, 5, 6. I ...
0
votes
1answer
2k views

Rename-Item using -Replace with multiple patterns

Consider the files: File1 (Custom).jpg File2(Custom).jpg I need to rename the files to strip away" (Custom)" and/or "(Custom)" from their Name string (notice the space before the opening parenthesis)...
0
votes
1answer
446 views

Parse RegEx in Excel

Suppose I have some Excel spreadsheet with the following column: A-345 hello hola B-389 nice C-6231 what A-12287 who just A-7819 C-45556 As you can see - I have a text combined ...
0
votes
1answer
101 views

How to insert CR before text pattern #:## in Excel cell text

I have large amounts of text in cells of a multi-row Excel spreadsheet. The text blocks in the cells are broken up by time stamps, e.g., “16:43” or, in some cases “4:43 PM”. I'd like to parse for the ...
1
vote
1answer
529 views

How to get only IP address from nmblookup for use in Bash script?

If I do: nmblookup myServerName I get: 192.168.6.106 myservername<00> Since I want to use the IP returned from nmblookup myServerName in a Bash script, I'd like to know the best way to ...
1
vote
1answer
815 views

How to split initials from names, in MS Excel?

I have a list of (around 1200) names in MS Excel which are in several different formats. Full names with 3 parts - ex: John Maynard Keynes Full names with 4 parts - ex: Mohomad Hussain Mohomad Niyas ...
0
votes
2answers
121 views

Return specific matched (sub) value with grep in linux

I'm running a Zabbix agent (logging software) on Ubuntu and wish to ping an internal IPIP/GRE Tunnel to constantly measure the quality of the connection. Now a Zabbix agent does not by default allow ...
1
vote
1answer
244 views

Camel-casing a 'dashed' string

I'm fairly inexperienced with *nix scripting, and I have a need to take a string with lowercase words separated by dashes and convert that to a new string with the dashes removed, and the first letter ...
2
votes
2answers
2k views

How to select the first number in cell in Excel?

I have a table that stores both a number and some text in a cell, and I want to do an arithmetic operation based on the numbers. So my table looks like this: Number1 | Number2 | Product 2 ...
0
votes
2answers
529 views

Parsing a text string in Excel

I have the following strings of text in Excel cells and need to get the value with the "%" symbol. I have tried several approaches with FIND, MID, LEN, SUBSTITUTE, etc., but haven't found the ...
8
votes
6answers
12k views

How to split a string with quotes (like command arguments) in bash?

I have a string like this: "aString that may haveSpaces IN IT" bar foo "bamboo" "bam boo" I want to be able to split it like this: aString that may haveSpaces IN IT bar foo bamboo bam boo ...
0
votes
1answer
173 views

MS Excel: MIN and FIND/SEARCH

I am trying to figure out what exactly excel is doing with these two functions. I have many rows of strings in a single column. I want to pull out the first numeric in those strings. The first number ...
1
vote
0answers
42 views

Parsing (or Converting) Buffered Output

If a dynamic, text-based, CLI application doesn't include an option for producing unbuffered text output; what options do I have for parsing said output? Can it be converted to a more appropriate ...
1
vote
1answer
83 views

Bash: return all the characters between the nth occurence of two different strings within a string

In a bash script (on Ubuntu 14.04) I'm running the command: WP055="$(wget -qO - http://alerts.weather.gov/cap/wwaatmget.php?x=CAZ055&y=1)" Within the WP055 variable string there will be an ...
0
votes
1answer
39 views

Using 'diff' compare usernames from file1 to file2 containing emails

I am trying to identify active accounts over dead accounts and was wondering if diff along with grep or sed or regex can be used, instead of writing a long program. File1 (usernames) ...
12
votes
3answers
5k views

Bash 4.3 Substring Negative Length on OS X

Bash 4.2 added support for negative substring lengths: http://tldp.org/LDP/abs/html/abs-guide.html#SUBSTREXTR01 Example 37-12. Negative parameter in string-extraction construct When the "...
0
votes
1answer
95 views

Extract the first 2 letters in each line of a file using a single command Terminal

I want to extract the first 2 letters of each line from a file and save it in a variable and print it in a single command. Can anyone help me with the command? Considering my file has 20 - 30 lines ...
3
votes
2answers
3k views

Extract a Whole Word From String Containing a Specific Letter or Character

I would like to extract only the word from a cell that contains a specific character ("=") within the text. A2: Dolly made me a homemade=cake and some muffins A3: we had cheese=cake for dinner A4: ...
3
votes
3answers
10k views

Split folder paths in Excel to return the final folder

I have a single column in Excel which has a file and folder path. e.g. C:\1_Folder\2_Folder\3_Folder\my_file.txt I would like to extract the name of the final folder and place this in a new column. ...
6
votes
2answers
21k views

Replace every nth instance of a character with a new line in Notepad++

I have a pipe delimited string of NAME|VALUE pairs looking something like this.. Name1|Value1|Name2|Value2|Name3|Value3 What I want to do is to replace every second instance of | with a new line so ...
-1
votes
2answers
62 views

Only show part of logfile in bash script

OpenVPN log looks like this: OpenVPN CLIENT LIST Updated,Sat Jun 20 04:20:07 2015 Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since [ A .... ] ROUTING TABLE Virtual Address,Common ...
1
vote
1answer
206 views

Swapping / exchanging two selections in Webstorm

Is there a way of swapping two selections under multiple carets like in sublime-text in the Jetbrains' editors like Webstorm. The default shortcut in sublime text is CTRL+T for the transpose command. ...