Where to install config files?
I'm writing an install noscript so when someone inexperienced downloads one of my noscripts they can run the install.sh noscript to set everything up for them.
At first I wrote it to create $HOME/bin and $HOME/bin/config folders (if they didn't exist). But some of my noscripts are written for Synology NAS devices and I remembered that on a Synology you can disable home folders. So I changed my install noscript to check if the $HOME folder exists, and if not then install the noscript in /etc/local/bin. But the config file and exclude files (for tar and rysnc) need to easily accessible and editable by inexperienced users.
Where should extra files that a noscript needs normally be installed?
If you want to see, and critique, what I've written so far it's here: https://gist.github.com/007revad/8df1075b6a67168e1c2e9042de42885b
https://redd.it/10ycc31
@r_bash
I'm writing an install noscript so when someone inexperienced downloads one of my noscripts they can run the install.sh noscript to set everything up for them.
At first I wrote it to create $HOME/bin and $HOME/bin/config folders (if they didn't exist). But some of my noscripts are written for Synology NAS devices and I remembered that on a Synology you can disable home folders. So I changed my install noscript to check if the $HOME folder exists, and if not then install the noscript in /etc/local/bin. But the config file and exclude files (for tar and rysnc) need to easily accessible and editable by inexperienced users.
Where should extra files that a noscript needs normally be installed?
If you want to see, and critique, what I've written so far it's here: https://gist.github.com/007revad/8df1075b6a67168e1c2e9042de42885b
https://redd.it/10ycc31
@r_bash
Gist
Script to install my other noscripts
Script to install my other noscripts. GitHub Gist: instantly share code, notes, and snippets.
can someone help me be able to send a zenity window to a logged in user?
I feel like I have tried every combo of modifying the DISPLAY variable but cannot get the window to pop up for that user.
Does anyone have a trick or a way to send a zenity (or equivalent) window to a logged in user.
https://redd.it/10yehfn
@r_bash
I feel like I have tried every combo of modifying the DISPLAY variable but cannot get the window to pop up for that user.
Does anyone have a trick or a way to send a zenity (or equivalent) window to a logged in user.
https://redd.it/10yehfn
@r_bash
Reddit
r/bash on Reddit: can someone help me be able to send a zenity window to a logged in user?
Posted by u/Azifor - No votes and no comments
is that can be done beneath only bash noscript ?
goal is
entering(editing) multiple text files (10s+) and exchange a specific line 'a line that exist in whole given text files exactly the same' exchange this line as it's few words ..exchange it to a given new line 'words' that will be in putted with 'read' as input from user 'user is me' , to change that word to anew given word for those multiple text files as only one time by doing such a noscript ? that can be only inside a bash noscript ?
https://redd.it/10ygj3q
@r_bash
goal is
entering(editing) multiple text files (10s+) and exchange a specific line 'a line that exist in whole given text files exactly the same' exchange this line as it's few words ..exchange it to a given new line 'words' that will be in putted with 'read' as input from user 'user is me' , to change that word to anew given word for those multiple text files as only one time by doing such a noscript ? that can be only inside a bash noscript ?
https://redd.it/10ygj3q
@r_bash
Reddit
r/bash - is that can be done beneath only bash noscript ?
Posted in the bash community.
identification of duplicate files within folders AND archives
I purposefully changed this from deduplication as, normally, files within zips are there for a reason, but I have stacks of zip files, and extracted zip files (yah know how lazy it is to extract but keep the zip for posterity).
I'm interested in a noscript that will generate sha1 all files within an folder of all files AND archives (gz,xy,zip,rar,7z) and output path and checksum to a text file, then another which will either identify duplicates or remove unique SHA1 checksums leaving me with a curated list of files which I can go through.
Has anyone done anything similar to this before pls ?
https://redd.it/10yq5kg
@r_bash
I purposefully changed this from deduplication as, normally, files within zips are there for a reason, but I have stacks of zip files, and extracted zip files (yah know how lazy it is to extract but keep the zip for posterity).
I'm interested in a noscript that will generate sha1 all files within an folder of all files AND archives (gz,xy,zip,rar,7z) and output path and checksum to a text file, then another which will either identify duplicates or remove unique SHA1 checksums leaving me with a curated list of files which I can go through.
Has anyone done anything similar to this before pls ?
https://redd.it/10yq5kg
@r_bash
Reddit
r/bash - identification of duplicate files within folders AND archives
Posted in the bash community.
printing from background
I have multiple tasks that run in the background. They are detached with
I would like to print a message to stdout when i am done. (This code is part of a "multithreading"-noscript that allows me to run multiple instances of a command easily)
what i have currently is the following:
$command &>> log.txt &
​
Just adding an echo does not work:
$command &>> log.txt && echo "$command: success!"
I would have to wait for
https://redd.it/10yvxcq
@r_bash
I have multiple tasks that run in the background. They are detached with
nohup and &I would like to print a message to stdout when i am done. (This code is part of a "multithreading"-noscript that allows me to run multiple instances of a command easily)
what i have currently is the following:
$command &>> log.txt &
​
Just adding an echo does not work:
$command &>> log.txt && echo "$command: success!"
I would have to wait for
$command to finish, which breaks my noscript. Can i print to the foreground shell from a background task?https://redd.it/10yvxcq
@r_bash
Reddit
r/bash - printing from background
Posted in the bash community.
Testing an unset variable returns true... always?
Running into some unexpected behavior. When testing if an unset variable is empty/non-empty, it always returns true.
I'm seeing the following:
This also happens using
Tested this on rhel 8 and ubuntu 22.04, is this expected behavior? I am confused.
https://redd.it/10yylr4
@r_bash
Running into some unexpected behavior. When testing if an unset variable is empty/non-empty, it always returns true.
I'm seeing the following:
$ echo ${TEST}
$ test -z ${TEST}; echo $?
0
$ test -n ${TEST}; echo $?
0
This also happens using
if [ ... ] as well. This happens when the variable is set to an empty string too (TEST='')Tested this on rhel 8 and ubuntu 22.04, is this expected behavior? I am confused.
https://redd.it/10yylr4
@r_bash
Reddit
r/bash on Reddit
Testing an unset variable returns true... always? - No votes and no comments
how to find files, rename and move then
How can I achieve this?
I tried something like
https://redd.it/10yzfs9
@r_bash
How can I achieve this?
I tried something like
find . -name *.txt | sed 's%\(path\)\(filename\).txt%\1\2.data' but that only changes the name/extension of the found file. Moving the file is only possible when I have the original name and the new one.https://redd.it/10yzfs9
@r_bash
Reddit
r/bash - how to find files, rename and move then
Posted in the bash community.
ChatGPT reviewed my plugin CtrlR.vim which mimics bash reverse-i-search
https://generativereview.substack.com/p/the-generative-review-1
https://redd.it/10z1wm2
@r_bash
https://generativereview.substack.com/p/the-generative-review-1
https://redd.it/10z1wm2
@r_bash
TGR
The Generative Review #1
ChatGPT, review this code
Question for bash expert
Hi everyone
I'm using a tool in CLI that requires one fila as argument: mycommand -f file.yaml
I would like to call this command in one line but with a "file" result of 2 other files merge.
It would have been:
$ cat file1.yaml file2.yaml > merged.yaml
$ mycommand -f merged.yaml
I used sometimes the triple < for input, like
$ jq . <<< ${contentInJson}
but I don't know how to use it in var as input/var
Does someone know a way to achieve that?
Thanks
https://redd.it/10zjtxl
@r_bash
Hi everyone
I'm using a tool in CLI that requires one fila as argument: mycommand -f file.yaml
I would like to call this command in one line but with a "file" result of 2 other files merge.
It would have been:
$ cat file1.yaml file2.yaml > merged.yaml
$ mycommand -f merged.yaml
I used sometimes the triple < for input, like
$ jq . <<< ${contentInJson}
but I don't know how to use it in var as input/var
Does someone know a way to achieve that?
Thanks
https://redd.it/10zjtxl
@r_bash
Reddit
r/bash on Reddit
Question for bash expert - No votes and 3 comments
What is bash written in?
I googled it and it says C, but when I open up a bash command it doesn't look like C. It looks like the following.
​
^B^@^B^O<84>MÿÿÿH<8b>-Ä ^B^@H<85>í^O<84>@ÿÿÿH»ÿÿÿÿÿÿÿ^H!ëH9ÝubL<8d>$í^@^@^@^@L<89>çèÑGÿÿH<89>^Eâ^^^B^@H<89>ÇH<85>ÀtCH<8b>^U<8b>^^^B^@H<89>Áë^NH<89>^QH<8b><92>°^@^@^@H<83>Á^HH<85>ÒuíH<89>îH<8d>^MÉÄÿÿº^H^@^@^@èÏDÿÿH<8b>-P ^B^@H9ë^O<84><92>^D^@^@A¿^D^@^@^@éÁþÿÿè^Eÿÿ<83>=t ^B^@^Bu^M<83>=×^^^B^@^@^O<84>Ý^D^@^@H<8b>=ê^]^B^@L<89>æèÊFÿÿH<89>^Eã^]^B^@H<89>ÇH<85>À^O<84>°^V^@^@º^B^@^@^@HÇÆ^@^@þÿèvGÿÿ<85>À^O<85>Ý^C^@^@H<8b>=·^]^B^@èòEÿÿH<83>À^A^O<84>Ç^C^@^@H<8b>=¡^]^B^@H<8d>-³î^@^@H<89>îè<82>ÌÿÿH<8b>=<8b>^]^B^@<85>Àu^Nés^D^@^@f<90>H<8b>=y^]^B^@è´EÿÿH<8b>=m^]^B^@H<89>îH<89>ÃèRÌÿÿ<85>ÀuÞH<8b>=W^]^B^@1ÒH<89>ÞèýFÿÿA<89>Ç<85>À^O<85>y^C^@^@H<8d><84>$<80>^@^@^@º^R^@^@^@¾^A^@^@^@H<8b>^M)^]^B^@H<89>ÇH<89>D$^HèÜCÿÿ^O·<84>$<80>^@^@^@D^O·¬$<90>^@^@^@D<8b>´$<8c>^@^@^@H<8d>P^AH<89>^Eà^G^B^@^O·<84>$<82>^@^@^@H<89>^UÙ^G^B^@f<89>D$^P^O·<84>$<86>^@^@^@fD<89>-Ö^^^B^@H<89>^D$<8b><84>$<88>^@^@^@<89>D$^XfE<85>í^O<85>=^D^@^@H<83><$^@^O<84><88>^D^@^@L<8b>-<99>^G^B^@D<89>ðH<89>D$ I<83>ý^A^O<84><8b>^D^@^@H<8b>=<88>^\^B^@èÛCÿÿ<83>=\^]^B^@^@^O<85>D^C^@^@H<8b>^M<87>^\^B^@HcÐL<8d>|^Qü<83>ø^C^O<8e>³^C^@^@A<80>?.^O<85>©^C^@^@è^GBÿÿI^O¾W^AH<8b>^@<83><<90>Z^O<85><92>^C^@^@I^O¾W^B<83><<90>I^O<85><83>^C^@^@I^O¾W^C<83><<90>P^O<85>t^C^@^@<83>=Ð^\^B^@^@^O<85>^^D^@^@H<8b>5^C^\^B^@H<8b>=^D^\^B^@è§Dÿÿ<85>À^O<84>^F^O^@^@<83>=d^G^B^@^A^O<84>^[^D^@^@<83>=Ã^\^B^@^@^O<85>^X^D^@^@L<8d>sèHÇD$^X^@^@^@^@H<8b>=Ñ^[^B^@1ÒL<89>öèwEÿÿA<89>Ç<85>À^O<85>u
what is this, I am looking to make a tui in python that reads bash commands from usr/bin and walks me through the command.
[https://redd.it/10znnly
@r_bash
I googled it and it says C, but when I open up a bash command it doesn't look like C. It looks like the following.
​
^B^@^B^O<84>MÿÿÿH<8b>-Ä ^B^@H<85>í^O<84>@ÿÿÿH»ÿÿÿÿÿÿÿ^H!ëH9ÝubL<8d>$í^@^@^@^@L<89>çèÑGÿÿH<89>^Eâ^^^B^@H<89>ÇH<85>ÀtCH<8b>^U<8b>^^^B^@H<89>Áë^NH<89>^QH<8b><92>°^@^@^@H<83>Á^HH<85>ÒuíH<89>îH<8d>^MÉÄÿÿº^H^@^@^@èÏDÿÿH<8b>-P ^B^@H9ë^O<84><92>^D^@^@A¿^D^@^@^@éÁþÿÿè^Eÿÿ<83>=t ^B^@^Bu^M<83>=×^^^B^@^@^O<84>Ý^D^@^@H<8b>=ê^]^B^@L<89>æèÊFÿÿH<89>^Eã^]^B^@H<89>ÇH<85>À^O<84>°^V^@^@º^B^@^@^@HÇÆ^@^@þÿèvGÿÿ<85>À^O<85>Ý^C^@^@H<8b>=·^]^B^@èòEÿÿH<83>À^A^O<84>Ç^C^@^@H<8b>=¡^]^B^@H<8d>-³î^@^@H<89>îè<82>ÌÿÿH<8b>=<8b>^]^B^@<85>Àu^Nés^D^@^@f<90>H<8b>=y^]^B^@è´EÿÿH<8b>=m^]^B^@H<89>îH<89>ÃèRÌÿÿ<85>ÀuÞH<8b>=W^]^B^@1ÒH<89>ÞèýFÿÿA<89>Ç<85>À^O<85>y^C^@^@H<8d><84>$<80>^@^@^@º^R^@^@^@¾^A^@^@^@H<8b>^M)^]^B^@H<89>ÇH<89>D$^HèÜCÿÿ^O·<84>$<80>^@^@^@D^O·¬$<90>^@^@^@D<8b>´$<8c>^@^@^@H<8d>P^AH<89>^Eà^G^B^@^O·<84>$<82>^@^@^@H<89>^UÙ^G^B^@f<89>D$^P^O·<84>$<86>^@^@^@fD<89>-Ö^^^B^@H<89>^D$<8b><84>$<88>^@^@^@<89>D$^XfE<85>í^O<85>=^D^@^@H<83><$^@^O<84><88>^D^@^@L<8b>-<99>^G^B^@D<89>ðH<89>D$ I<83>ý^A^O<84><8b>^D^@^@H<8b>=<88>^\^B^@èÛCÿÿ<83>=\^]^B^@^@^O<85>D^C^@^@H<8b>^M<87>^\^B^@HcÐL<8d>|^Qü<83>ø^C^O<8e>³^C^@^@A<80>?.^O<85>©^C^@^@è^GBÿÿI^O¾W^AH<8b>^@<83><<90>Z^O<85><92>^C^@^@I^O¾W^B<83><<90>I^O<85><83>^C^@^@I^O¾W^C<83><<90>P^O<85>t^C^@^@<83>=Ð^\^B^@^@^O<85>^^D^@^@H<8b>5^C^\^B^@H<8b>=^D^\^B^@è§Dÿÿ<85>À^O<84>^F^O^@^@<83>=d^G^B^@^A^O<84>^[^D^@^@<83>=Ã^\^B^@^@^O<85>^X^D^@^@L<8d>sèHÇD$^X^@^@^@^@H<8b>=Ñ^[^B^@1ÒL<89>öèwEÿÿA<89>Ç<85>À^O<85>u
what is this, I am looking to make a tui in python that reads bash commands from usr/bin and walks me through the command.
[https://redd.it/10znnly
@r_bash
Reddit
r/bash - What is bash written in?
Posted in the bash community.
gh-f adds diff per filetype and other small improvements
gh-f is a GitHub CLI extension that I wrote that does all-things-fzf for git. From time to time I add new small features or quality of life adjustments :).
Latest I added the possibility to diff, add and checkout filetypes based on extension only, see below:
​
https://i.redd.it/sa5w25fdglha1.gif
together with support for git environment variables and other minor fixes to cherry pick files and branches. There are many more features available as shown in the gif: hop by and have a look!
Link to the repository
https://redd.it/10zsubv
@r_bash
gh-f is a GitHub CLI extension that I wrote that does all-things-fzf for git. From time to time I add new small features or quality of life adjustments :).
Latest I added the possibility to diff, add and checkout filetypes based on extension only, see below:
​
https://i.redd.it/sa5w25fdglha1.gif
together with support for git environment variables and other minor fixes to cherry pick files and branches. There are many more features available as shown in the gif: hop by and have a look!
Link to the repository
https://redd.it/10zsubv
@r_bash
GitHub
GitHub - gennaro-tedesco/gh-f: 🔎 the ultimate compact fzf gh extension
🔎 the ultimate compact fzf gh extension. Contribute to gennaro-tedesco/gh-f development by creating an account on GitHub.
Bash/programming community
Are there any good programming forums that is active with discussions etc, not the stackoverflow page but some other?
I have a task im stuck on and in need for some help in my noscript
Appreciate any answers :)
https://redd.it/10zumn2
@r_bash
Are there any good programming forums that is active with discussions etc, not the stackoverflow page but some other?
I have a task im stuck on and in need for some help in my noscript
Appreciate any answers :)
https://redd.it/10zumn2
@r_bash
Reddit
r/bash - Bash/programming community
Posted in the bash community.
How do I concat multiple child nodes while referencing to another node with xmlstarlet?
Hello everyone, I'd like to ask for some help.
# Background
I'm planning to parse xml and extract the data I need and input them to SQLITE database. I thought that I could achieve this by creating the statement in a file and run it with sqlite3.
INSERT INTO table (col1,col2)
VALUES
(col1,col2)
#
# XML Structure
The xml has structure like this.
<TaskerData sr="" dvi="1" tv="6.1.9-beta">
<Project sr="proj0" ve="2">
<cdate>1675479414660</cdate>
<name>Quick Tile</name>
<psort>Alpha</psort>
<tids>145,358</tids>
</Project>
<Task sr="task145">
<id>145</id>
<Action sr="act0" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">BB</Str>
</Action>
<Action sr="act1" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">AA</Str>
</Action>
</Task>
<Task sr="task146">
<id>146</id>
<Action sr="act0" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">BB</Str>
</Action>
</Task>
</TaskerData>
​
# Attempted Solution
I want to form the values pattern with the value of
Here's my attempted code.
xmlstarlet sel -t \
-m "//TaskerData/Task./Action[code='130']" \
-v "concat('(\"' ,id, '\", \"', Actioncode='130'/Str@sr='arg0', '\"), ')" -n \
It outputs the format I want
("145", "BB"),
("146", "BB"),
However the code only catch the first occurrence of
​
# Desired Output
How do I make concat to recognizes multiple child nodes and form the following format?
("145", "BB"),
("145", "AA"),
("146", "BB"),
​
Thankyou!
https://redd.it/11099f2
@r_bash
Hello everyone, I'd like to ask for some help.
# Background
I'm planning to parse xml and extract the data I need and input them to SQLITE database. I thought that I could achieve this by creating the statement in a file and run it with sqlite3.
INSERT INTO table (col1,col2)
VALUES
(col1,col2)
#
# XML Structure
The xml has structure like this.
<TaskerData sr="" dvi="1" tv="6.1.9-beta">
<Project sr="proj0" ve="2">
<cdate>1675479414660</cdate>
<name>Quick Tile</name>
<psort>Alpha</psort>
<tids>145,358</tids>
</Project>
<Task sr="task145">
<id>145</id>
<Action sr="act0" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">BB</Str>
</Action>
<Action sr="act1" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">AA</Str>
</Action>
</Task>
<Task sr="task146">
<id>146</id>
<Action sr="act0" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">BB</Str>
</Action>
</Task>
</TaskerData>
​
# Attempted Solution
I want to form the values pattern with the value of
id and Action[code='130']/Str[@sr='arg0'] from Task node that matches //TaskerData/Task[./Action[code='130']]Here's my attempted code.
xmlstarlet sel -t \
-m "//TaskerData/Task./Action[code='130']" \
-v "concat('(\"' ,id, '\", \"', Actioncode='130'/Str@sr='arg0', '\"), ')" -n \
It outputs the format I want
("145", "BB"),
("146", "BB"),
However the code only catch the first occurrence of
Action[code='130']/Str[@sr='arg0']​
# Desired Output
How do I make concat to recognizes multiple child nodes and form the following format?
("145", "BB"),
("145", "AA"),
("146", "BB"),
​
Thankyou!
https://redd.it/11099f2
@r_bash
Reddit
r/bash - How do I concat multiple child nodes while referencing to another node with xmlstarlet?
Posted in the bash community.
hey i dicided to learn bash is the “bash mastery: the complete guide to bash noscripting “ good ?
https://redd.it/110b7tp
@r_bash
https://redd.it/110b7tp
@r_bash
Reddit
r/bash - hey i dicided to learn bash is the “bash mastery: the complete guide to bash noscripting “ good ?
Posted in the bash community.
A minimal project setup using make from within Vim to run shellscheck and ctags on current shell noscript.
Hello.
Say you have a collection of noscripts that sources the same files, wouldn't it be nice if you had one command that worked on all of them, showing the errors in the quick fix window, and ran `exurbant ctags` on the source files, all by pressing one hotkey?
`ctags creates a tags file, so that you later can jump to any sourced function by hitting `Ctrl-]`, when standing on it in your current noscript, during editing?
(It works with FZF Tags command in Vim too.)
You need to have `exuberant ctags` and `GNU make` installed.
Here is the Makefile, named shellcheck.mkf and goes in the working directory of your project, staying in that directory is crucial for it to work. You need to change the above source files.
# Makefile to be run from vim, to run shellcheck.
# Vim-licence (c) 2023 McUsr
SOURCES := file1.sh file2.sh
$(TARGET) :: $(SOURCES)
-@shellcheck -f gcc -a -x $^ $@
-@ctags --language-force=sh $^
Here is the compiler file, that is named `shellcheck.vim` and it is put in `$HOME/.vim/compiler`
https://redd.it/110fwlu
@r_bash
Hello.
Say you have a collection of noscripts that sources the same files, wouldn't it be nice if you had one command that worked on all of them, showing the errors in the quick fix window, and ran `exurbant ctags` on the source files, all by pressing one hotkey?
`ctags creates a tags file, so that you later can jump to any sourced function by hitting `Ctrl-]`, when standing on it in your current noscript, during editing?
(It works with FZF Tags command in Vim too.)
You need to have `exuberant ctags` and `GNU make` installed.
Here is the Makefile, named shellcheck.mkf and goes in the working directory of your project, staying in that directory is crucial for it to work. You need to change the above source files.
# Makefile to be run from vim, to run shellcheck.
# Vim-licence (c) 2023 McUsr
SOURCES := file1.sh file2.sh
$(TARGET) :: $(SOURCES)
-@shellcheck -f gcc -a -x $^ $@
-@ctags --language-force=sh $^
Here is the compiler file, that is named `shellcheck.vim` and it is put in `$HOME/.vim/compiler`
https://redd.it/110fwlu
@r_bash
Reddit
r/bash - A minimal project setup using make from within Vim to run shellscheck and ctags on current shell noscript.
Posted in the bash community.
Exit noscript and restart again
I have a noscript with inotify-tools that emails me when a transfer is finished. Sometimes, there is _edit in the filename and I want it removed, so I have an if then with a
If I have:
It works fine, but that obviously stops my noscript. How would I have my noscript run again. I made it a systemd service and the service is in
To clarify, this rename is only to happen if _edit is in the filename, so I don't need to exit and restart otherwise.
https://redd.it/110kp12
@r_bash
I have a noscript with inotify-tools that emails me when a transfer is finished. Sometimes, there is _edit in the filename and I want it removed, so I have an if then with a
mv command to rename the file to get rid of _edit in the filename. But when this happens, inotify-tools runs again and emails me about the filename change, which I don't want.If I have:
mv filename_edit.mp4 filename.mp4 && exitIt works fine, but that obviously stops my noscript. How would I have my noscript run again. I made it a systemd service and the service is in
/lib/systemd/system/transfernotify.service while the actual noscript is in /usr/bin/transfernotify.shTo clarify, this rename is only to happen if _edit is in the filename, so I don't need to exit and restart otherwise.
https://redd.it/110kp12
@r_bash
Reddit
r/bash - Exit noscript and restart again
Posted in the bash community.
I'd like your opinion on my choice of Bash for data manipulation/cleaning and some stats
Hi everyone,
This may sound strange, but everything's pretty much in the noscript. More explanations:
I'm a researcher in the field of linguistics. I do text analysis mainly in order to understand how certain corpora/datasets of textual data are organized, how certain people use certain words, how certain words evolve over time etc... I'm not originally a programmer, so I pretty much had to learn by myself, which was pretty tough at the beginning. I started with Python, then I had to learn some R for a post-doc, I liked it so I stuck with it for a while, and then for a more recent project I had to deal with much larger datasets of Twitter data. The file were around 20-30Gb in size, so I did not know of R or Python workarounds to clean and manipulate all that without loading the files in memory on my laptop, so I decided to use Bash (which I learned the basics of at the same time as the other languages), which is much lighter and thus could do the job much more easily with combinations of grep, sed, awk etc... So I used those,and decided to completely ditch Python and R in order to focus on one Bash only! I like the lightweight aspect of it, its efficiency, speed and the overall simplicity.
The thing is that I'm not a programmer, and research is not at all the core of my job since I also teach (English). Since I do not necessarily program consistently throughout the year, I don't want to focus on too many languages and forget most of that in the five months during which I sometimes may not program. Also, I realize that I may not always rely 100% on Bash, especially for visualization, but I also use some GUI software developed for corpus linguistics, so these are the core of my 'fine-grained' analyses, programming in my case being mostly used for cleaning/manipulation and some stats.
Thus, it seems to be working pretty well for me so far, but I'm wondering whether this seems strange/not adapted/too limited for people who are a lot more advanced and familiar with these tools. Any thoughts on that? Does it seem too unconventional and so am I risking to encounter huge bottlenecks in the future? After all, one may wonder that if language like R and Python exist as well as specialized libraries, it may be because they are better suited for the job...
Thanks for any insights! : )
https://redd.it/110qpqf
@r_bash
Hi everyone,
This may sound strange, but everything's pretty much in the noscript. More explanations:
I'm a researcher in the field of linguistics. I do text analysis mainly in order to understand how certain corpora/datasets of textual data are organized, how certain people use certain words, how certain words evolve over time etc... I'm not originally a programmer, so I pretty much had to learn by myself, which was pretty tough at the beginning. I started with Python, then I had to learn some R for a post-doc, I liked it so I stuck with it for a while, and then for a more recent project I had to deal with much larger datasets of Twitter data. The file were around 20-30Gb in size, so I did not know of R or Python workarounds to clean and manipulate all that without loading the files in memory on my laptop, so I decided to use Bash (which I learned the basics of at the same time as the other languages), which is much lighter and thus could do the job much more easily with combinations of grep, sed, awk etc... So I used those,and decided to completely ditch Python and R in order to focus on one Bash only! I like the lightweight aspect of it, its efficiency, speed and the overall simplicity.
The thing is that I'm not a programmer, and research is not at all the core of my job since I also teach (English). Since I do not necessarily program consistently throughout the year, I don't want to focus on too many languages and forget most of that in the five months during which I sometimes may not program. Also, I realize that I may not always rely 100% on Bash, especially for visualization, but I also use some GUI software developed for corpus linguistics, so these are the core of my 'fine-grained' analyses, programming in my case being mostly used for cleaning/manipulation and some stats.
Thus, it seems to be working pretty well for me so far, but I'm wondering whether this seems strange/not adapted/too limited for people who are a lot more advanced and familiar with these tools. Any thoughts on that? Does it seem too unconventional and so am I risking to encounter huge bottlenecks in the future? After all, one may wonder that if language like R and Python exist as well as specialized libraries, it may be because they are better suited for the job...
Thanks for any insights! : )
https://redd.it/110qpqf
@r_bash
Reddit
r/bash - I'd like your opinion on my choice of Bash for data manipulation/cleaning and some stats
Posted in the bash community.
Script to comment out lines
I'm trying to comment out some lines in a file that are between four hash characters like this:
####
here
are
some
lines
####
I want that to be changed to this:
# here
# are
# some
# lines
So here is the relevant part of my noscript:
insection=false
while read line; do
if [ "$line" == "####" ]; then
insection=! $insection
elif [ -z "$line" ]; then
echo "" >> "$file.temp"
elif [ "$insection" = true ]; then
echo "# $line" >> "$file.temp"
else
echo "$line" >> "$file.temp"
fi
done < "$file"
And at the end to remove '####':
sed -i '/####/d' "$file"
Only removing the hash characters at the end is working, any idea what's wrong?
https://redd.it/110uinf
@r_bash
I'm trying to comment out some lines in a file that are between four hash characters like this:
####
here
are
some
lines
####
I want that to be changed to this:
# here
# are
# some
# lines
So here is the relevant part of my noscript:
insection=false
while read line; do
if [ "$line" == "####" ]; then
insection=! $insection
elif [ -z "$line" ]; then
echo "" >> "$file.temp"
elif [ "$insection" = true ]; then
echo "# $line" >> "$file.temp"
else
echo "$line" >> "$file.temp"
fi
done < "$file"
And at the end to remove '####':
sed -i '/####/d' "$file"
Only removing the hash characters at the end is working, any idea what's wrong?
https://redd.it/110uinf
@r_bash
Reddit
r/bash - Script to comment out lines
Posted in the bash community.
This is a shell noscript that provides a mommy function which emulates a nurturing and supportive figure
https://github.com/sudofox/shell-mommy
https://redd.it/110xa38
@r_bash
https://github.com/sudofox/shell-mommy
https://redd.it/110xa38
@r_bash
GitHub
GitHub - sudofox/shell-mommy: Mommy is here for you on the command line ~ ❤️
Mommy is here for you on the command line ~ ❤️. Contribute to sudofox/shell-mommy development by creating an account on GitHub.