241 questions
-2
votes
1
answer
118
views
Create multiple modified versions of a script for submission to cluster
I am trying create child scripts from one parent script where a few parameters are modified (48 child scripts, so automation would be preferred). My intention for this is to run different Modelica ...
0
votes
1
answer
384
views
Converting SystemVerilog Structs Into C/C++ Structs
Somewhere in my environment, there's a large file that contains (among other stuff) many System Verilog structs of 64 bits,
e.g.:
typedef struct packed {
logic [63:63] my_field_1;
logic [62:...
0
votes
1
answer
76
views
Trouble with 'keydown' Event in Chrome Extension: Capturing Backspace Action
I am creating a Chrome extension (code here) and am having trouble with the "keydown" event. I want to use it to capture a 'backspace' before it happens, in order to switch the text the user ...
0
votes
1
answer
111
views
How do I combine multiple IF statements using different parts of a String in Excel?
Based on a String input, I need to output the meaning of the String based on different criteria's. The String length will always be 8 Characters and the first four and last two characters mean ...
3
votes
1
answer
223
views
Replace multiline section of a file with a multiline string, both containing special characters and escape sequences
I have a file which has a section like the following, only one key/value pair is provided but there could be N number:
"Section Name"
{
"Key" "{\"...
1
vote
1
answer
56
views
How to split and concate text separated by commas with the corresponding text in the pposing column in pandas
So I'm trying to join text separated by commas in one column, and join it with the text in corresponding position in the opposing column. English isn't my first language but I think that the photo ...
0
votes
0
answers
119
views
Limit each line in a text file to 152 characters using PowerShell
I had a text file with multiple lines. Our software is not picking up files with characters more or less than 152 characters per line. So, I need a PowerShell script to limit the number of characters ...
0
votes
2
answers
64
views
How to break a string based on a word in a txt file with batch script
I have been reading around here for several days, and I have found many shared scripts but it doesn't appear that those shared here can help me with my request, I have also looked online and I can't ...
0
votes
1
answer
168
views
How to print each column of strings separately in python?
I have used python to print a string "aaaaabbbbbccccc" into 5 separate columns of characters. I have not used an array to do this.
a a a a a
b b b b b
c c c c c
Now I want to print each ...
1
vote
1
answer
87
views
How to remove multi-line blocks of text of varying sizes from a file given the first and last lines and a substring?
I have an xml file listing several games and their metadata, like so:
<?xml version="1.0"?>
<gameList>
<game>
<path>./Besiege.desktop</path>
...
0
votes
1
answer
50
views
How can I remove a list of substrings, then find and delete the first TAB and after in a CSV with multiple lines?
Example of my dataset "doc name with spaces.csv" (with anonymized data) file that has multiple lines.
Length of file will be variable from day to day as part of an export.
Patient Full Name ...
0
votes
2
answers
97
views
Data extraction for specific string
I have a long list of JSON data, with repeats of contents similar to followings.
Due to the original JSON file is too long, I will just shared the hyperlinks here. This is a result generated from a ...
0
votes
2
answers
79
views
place the symbol
to add certain symbol after every three got splited lines Something like that?? -
print('@'.join(st_text[i:i + 3] for i in range(0, len(st_tex), 3)))
0
votes
3
answers
985
views
Take only letters from the string and reverse them
I'm preparing for my interview, faced the problem with the task. The case is that we're having a string:
test12pop90java989python
I need to return new string where words will be reversed and numbers ...
2
votes
4
answers
149
views
Given a logfile.txt, I want to extract the java script name only; e.g. filename.js using a bash script
I use following awk script to do so,
for line in $1
do
grep -F ".js" $1 | awk '{print $7}' | sort -u
done
the out put is almost there:
/blog/wp-includes/js/swfobject.js?ver=2.2
/fla/...
0
votes
2
answers
40
views
How to save pandas textmanipulation as csv in the correct form
I have a *.txt file with numbers. I want to eliminate the spaces.
The raw data looks like this
12 12345 1234
23 23456 234
If I use the following
data=data[0].str.replace(" ","")
...
0
votes
2
answers
80
views
Organizing text blocks as rows in R
I have a text file containing details of about 1000 articles, each containing the same items (PMC, PMID..... AID, SO). I need to have every article details as a single row such that the item names are ...
3
votes
1
answer
225
views
How to I set a symbol inside the record separator of awk
How do I include symbols into the record separator of awk. I know the basic syntax like this:
awk 'BEGIN{RS="[:.!]"}{if (tolower($0) ~ "$" ) print $0 }'
which will separate a ...
0
votes
2
answers
81
views
How do you loop over files containing A and B in bash?
I'm looking for all the files in a directory that contain "AAA" and "BBB".
I then want to modify/do stuff with each of the found files. The file names do contain spaces.
grep ...
2
votes
4
answers
121
views
How can I select a string by reading a field name and use it to place it in a different field in bash?
I have a huge text file (thousands of lines) containing chuncks of information (previously filtered) which are separated by an empty line. Example with a few of them:
Name: CAR 8:1
Precursor type: [M]+...
1
vote
0
answers
76
views
Remove all texts until certain string in multiple text files using python
I have 14680 text files and after certain String I want to delete all the lines in each text files, how to accomplish this using python
Thanks and Regards
1
vote
1
answer
2k
views
Using JQ to filter JSON data at different levels
I have this JSON data : some-json-file which contains the following
{
"result": [
{
"id": "1234567812345678",
"name": "somewebsite.com&...
0
votes
1
answer
34
views
Getting rid of duplicates in text strings in new column by identifying differences in original data and using this difference in new column
I have sort of more general question on the process on working with text data.
My goal is to create UNIQUE short labels/description on products from existing long descriptions based on specific rules.
...
1
vote
4
answers
320
views
Is there a way to search for a word in a file and save both said word and another word I know the beginning of?
I am looking for a way to filter a (~12 Gb) largefile.txt with long strings in each line for each of the words (one per line) in a queryfile.txt. But afterwards, instead of outputting/saving the whole ...
0
votes
0
answers
1k
views
Matching Excel patterns with RegEX
I'm trying to make a program (I have been using AutoHotKey) to manipulate Excel formulas to show what's happening.
An example of what I want to do:
Cell A1: 1
Cell A2: 1
Cell A3: =A1+A2 (shown as 2 ...
1
vote
1
answer
790
views
JQ: Remove empty arrays from JSON
I am having trouble deleting all empty arrays from a JSON file with jq.
I've tried:
walk(if type == "array" then map(select(length > 0)) else . end)
which removes empty strings, but the ...
0
votes
2
answers
2k
views
Why does textContent addition assignment doesn't work with tags?
I am trying to add some text to an existing element using textContent. But when I use +=(addition assignment) operator but in the result, already existing tags like b has lost its effect. I think I am ...
-1
votes
2
answers
109
views
How to extract the longest words alphabetically in a text in Python?
I have a problem as I am a total beginner to Python, now learning text-manipulation. I am trying to extract the five longest words in a text, create a list with those items and order them ...
1
vote
1
answer
275
views
Merge two txt files as columns in Windows
I need to be able to merge as separate columns files with millions of lines. I tried using the suggested code here:
@echo off
set f1=1.txt
set f2=2.txt
set outfile=mix.txt
type nul>%outfile%
(
...
0
votes
1
answer
80
views
replace string inside var based of a format in another string
I'm getting 2 arguments inside a script and I want to replace part of the string in arg1 based of the format of arg2, where DATEFORMAT is the reserved word for the placeholder. For example:
]$ ./a.sh ...
0
votes
1
answer
406
views
CamelCase to snake_case in C without tolower
I want to write a function that converts CamelCase to snake_case without using tolower.
Example: helloWorld -> hello_world
This is what I have so far, but the output is wrong because I overwrite a ...
1
vote
2
answers
466
views
Concatenate CSV files and skip SECOND row
I'm using PowerShell to concatenate social media log files and Facebook, in their infinite wisdom, have added a SECOND row to their header line.
I currently use this:
Get-ChildItem -Filter *.csv | ...
1
vote
0
answers
561
views
Prevent Powershell file write splitting/wrapping text in to multiple lines, when run from Azure Automation
I have executed the following commands from Azure Automation(to run inside a VM). I tried all file write commands(Out-File, Add-Content, Set-Content) but the output string always comes in multiple ...
1
vote
1
answer
121
views
Replace empty values based on part of the text from another variable in Pandas dataframe, using filter and regex expression
I want to replace empty values with part of the text I find in another variable in Pandas. To achieve this, I need to make use of a regex expression to extract the exact text value I want transferred, ...
0
votes
1
answer
195
views
Count hyperlinks in power bi
I have a column named "body" and in this columns there many rows that contain hyperlinks in text.
is it possible in power bi to count if there is a hyperlink in text then create a new ...
0
votes
4
answers
1k
views
How to split a text file into smaller files based on regex pattern?
I have a file like the following:
SCN DD1251
UPSTREAM DOWNSTREAM FILTER
NODE LINK NODE LINK LINK ...
0
votes
1
answer
180
views
How to sort text by section and also sort lines under the section in linux?
I have a text config file which is like this:
config server 'server'
option url 'https://chef.libremesh.org'
config client 'client'
option upgrade_packages '1'
option ...
0
votes
2
answers
1k
views
Insert text n lines before the end of file
I have this file and I would like to be able to write text n lines before the end of the file in python, I know the write method exists however it only inserts text at the very end of the file. I ...
0
votes
2
answers
587
views
sed command not modifying the file [duplicate]
I copy /etc/default/keybord and make a keyboard2 file.
When I cat the file I get :
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="fr&...
0
votes
0
answers
54
views
bash: adding various names to associated interface names in a list
I'm maintaining a network monitoring tool, and am trying to set up custom polling for trunk interfaces. The tool has its own proprietary scripts that do a variety of things.
So far, I have a script ...
0
votes
0
answers
877
views
Filtering text while reading data into R with fread
I have a large dataset and I wanted to read it in with fread, taking advantage of the select argument to only pick columns I need for this specific analysis. I was wondering if anyone knows a way that ...
1
vote
2
answers
139
views
remove a certain part of a text string
I'm trying to remove some part of a string in order to isolate a value of a sentence.
I would like to store the thing that is liked in a var called thingLoved. So when you type "I love cats" ...
0
votes
1
answer
278
views
PowerShell - Why is this not renaming my files?
I have been looking around for a way to quickly and easily rename hundreds os files in one go.
something where I only have to change smalle parts for it to be reused somewhere else.
So i ended up ...
0
votes
1
answer
727
views
Concatenate column values in csv based on grouping condition
I have a csv that is like the below (Note: values in Name column are not limited i.e. not only ABC and DEF):
Name, Type, Text
ABC, Type A, how
ABC, Type A, are
ABC, Type A, you
ABC, Type B, Your
ABC, ...
0
votes
1
answer
73
views
Import block data of a text file in Matlab
Suppose I have a simple text file named "test.txt" of the format below
A=-1.1,2.2,-3.3,4.4B
My intention is to extract data -1.1, 2.2, -3.3 and 4.4 in Matlab from the text file.
How could I ...
0
votes
1
answer
1k
views
String limit lines JS
I was looking other answers, and they are all based on something like this:
.text-limit{
line-height:20px;
height: 20 * n. lines;
overflow: hidden;
}
However what i want i something like ...
1
vote
3
answers
109
views
Split string into array of exactly two parts when a number is encountered
Is there a way to split a string into an array of exactly two parts when a number is encountered (preferably using split())?
Examples:
"Nutritional Value per 100 gram" ==> ["Nutritional Value per", "...
3
votes
0
answers
246
views
Retaining paragraph numbering in docx using the R officer package
How can I retain the numbering of paragraphs when extracting text from a docx file?
I'm doing some NLP-ML work on a bunch of docx files, and to begin with I need to break up each doc into a dataframe. ...
1
vote
2
answers
166
views
Problem with text formating in applescript
I have been trying to tackle a problem I am having extracting text from a website and filtering it to get the information I want. I have gotten to the point where I create a TextEdit file from the ...
-1
votes
2
answers
133
views
iterate over a series of strings and replace spaces between two numbers with zeros
I have a file such as this:
ME45 P 1311 41130 1.253
ME39 P 1311 41130 7.700
ME38 P 1311 41130 7.776
ME37 P 1311 41130 8.285
ME36 P 1311 41130 8.689
ME30 P 1311 4113010.252
ME26 P 1311 ...