bash

Find command find directories that were created after a certain date under Linux/Cygwin

天涯浪子 提交于 2021-02-05 02:36:52
问题 I want to use the find command to find these directories: Access: 2013-12-13 10:59:46.190886900 -0500 Modify: 2013-12-03 07:04:02.995890600 -0500 Change: 2013-12-03 07:04:02.995890600 -0500 Birth: 2013-12-02 07:04:02.000000000 -0500 (I want a time after '12-03') This is the command I ran but it still lists older directories: find . -type d -newerBt '2013-12-03 00:00:00' -exec du -h {} \; How can I modify this line to find the directories created after that date? What is the difference between

Find command find directories that were created after a certain date under Linux/Cygwin

眉间皱痕 提交于 2021-02-05 02:36:02
问题 I want to use the find command to find these directories: Access: 2013-12-13 10:59:46.190886900 -0500 Modify: 2013-12-03 07:04:02.995890600 -0500 Change: 2013-12-03 07:04:02.995890600 -0500 Birth: 2013-12-02 07:04:02.000000000 -0500 (I want a time after '12-03') This is the command I ran but it still lists older directories: find . -type d -newerBt '2013-12-03 00:00:00' -exec du -h {} \; How can I modify this line to find the directories created after that date? What is the difference between

grep lines that start with a specific string

你。 提交于 2021-02-05 00:59:27
问题 I want to find all the lines in a file that start with a specific string. The problem is, I don't know what's in the string beforehand. The value is stored in a variable. The naïve solution would be the following: grep "^${my_string}" file.txt; Because if the Bash variable my_string contains ANY regular expression special characters, grep will cry, and everyone will have a bad day. You don't want to make grep cry, do you? 回答1: You should use awk instead of grep for non-regex search using

grep lines that start with a specific string

こ雲淡風輕ζ 提交于 2021-02-05 00:56:30
问题 I want to find all the lines in a file that start with a specific string. The problem is, I don't know what's in the string beforehand. The value is stored in a variable. The naïve solution would be the following: grep "^${my_string}" file.txt; Because if the Bash variable my_string contains ANY regular expression special characters, grep will cry, and everyone will have a bad day. You don't want to make grep cry, do you? 回答1: You should use awk instead of grep for non-regex search using

Bash regex ungreedy match

和自甴很熟 提交于 2021-02-04 22:16:15
问题 I have a regex pattern that is supposed to match at multiple places in a string. I want to get all the match groups into one array and then print every element. So, I've been trying this: #!/bin/bash f=$'\n\tShare1 Disk\n\tShare2 Disk\n\tPrnt1 Printer' regex=$'\n\t(.+?)\\s+Disk' if [[ $f =~ $regex ]] then for match in "${BASH_REMATCH[@]}" do echo "New match: $match" done else echo "No matches" fi Result: New match: Share1 Disk Share2 Disk New match: Share1 Disk Share2 The expected result

replacing a placeholder in a html file with 1-n specific values defined in a config.json using shellscript [closed]

Deadly 提交于 2021-02-04 21:59:08
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 months ago . Improve this question The Problem: I need to replace a placeholder ( __PLACEHOLDER__ ) in a html file index.html with 1-n specific values defined in a config.json file. what I tried: replacing the placeholder inside index.html with new content: echo "${html//__PLACEHOLDER__/$replace}" > index.html

replacing a placeholder in a html file with 1-n specific values defined in a config.json using shellscript [closed]

浪子不回头ぞ 提交于 2021-02-04 21:58:23
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 months ago . Improve this question The Problem: I need to replace a placeholder ( __PLACEHOLDER__ ) in a html file index.html with 1-n specific values defined in a config.json file. what I tried: replacing the placeholder inside index.html with new content: echo "${html//__PLACEHOLDER__/$replace}" > index.html

Create a python script that install python modules and run some commands

自作多情 提交于 2021-02-04 21:55:47
问题 I want to create a thin wrapper around this library https://github.com/jupyter-incubator/sparkmagic#installation As you can see in the link, the installation step requires installing some packages with pip run some command of the type jupyter enable ... or jupyter-kernelspec install custom configuration file that I want to generate and place in the correct place I am checking which options I have to make the installation as automatic as calling a script. So far I have came up creating a bash

“alias: =: not found”, and alias not defined, with “alias ll = 'ls -l'” in .bashrc

不羁的心 提交于 2021-02-04 21:53:01
问题 I'm on Mac OSX and trying to put some basic aliases in .bashrc (e.g. alias ll = 'ls -l' ). I sourced .bashrc in .bash_profile, and on startup it recognizes a function that I have in .bashrc. However, I get the following error messages every time I add an alias and then try to start it up: -bash: alias: ll: not found -bash: alias: =: not found -bash: alias: ls -l: not found The ll alias does not work, but the command declared by the following function does: #!/bin/bash # prints the input

“alias: =: not found”, and alias not defined, with “alias ll = 'ls -l'” in .bashrc

不打扰是莪最后的温柔 提交于 2021-02-04 21:52:00
问题 I'm on Mac OSX and trying to put some basic aliases in .bashrc (e.g. alias ll = 'ls -l' ). I sourced .bashrc in .bash_profile, and on startup it recognizes a function that I have in .bashrc. However, I get the following error messages every time I add an alias and then try to start it up: -bash: alias: ll: not found -bash: alias: =: not found -bash: alias: ls -l: not found The ll alias does not work, but the command declared by the following function does: #!/bin/bash # prints the input