Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I can't find this in the linux --help.
may you please tell me what theses commands are dowing
NAME=gs://toto-titi-dfs-dfe-gfd-zed/
then the ambiguous commands are :
NAME="${NAME//\\/\\\\}"
NAME="${NAME//\//\\/}"
then we have these two commands:
sudo sed -i "s/spark\.eventLog\.dir.*/spark\.eventLog\.dir $NAME/g" /usr/lib/spark/conf/spark-defaults.conf
sudo sed -i "s/spark\.history\.fs\.logDirectory.*/spark\.history\.fs\.logDirectory $NAME/g" /usr/lib/spark/conf/spark-defaults.conf
Which I can't understand too
Any help with this please
Thanks a lot
Set the variable NAME to the string gs://toto-titi-dfs-dfe-gfd-zed/
Swap out all instances of \ with \\ in that variable using NAME="${NAME//\\/\\\\}" Read about Shell Parameter Expansion here specifically the section labelled ${parameter/pattern/string}.
Swap out all instaces of / with \/ in the NAME variable using AME="${NAME//\//\\/}". These two steps are being performed to escape out the / and \ in the NAME variable so that sed doesn't choke.
In file /usr/lib/spark/conf/spark-defaults.conf replace out matches of spark.eventLog.dir.* with spark.eventLog.dir $NAME
In file /usr/lib/spark/conf/spark-defaults.conf replace out matches of spark.history.fs.logDirectory.* with spark.history.fs.logDirectory $NAME
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I'm trying to enter input without typing anything I'm trying to put the input in the command.
I've seen people try this:
printf 'argument\n' | command
Or
command <<< "argument\n"
I don't know if what I'm doing is command specific but neither of these work for what I'm trying to do.
I'm trying to zip a file with a password:
zip -r -e test.zip test_zip/
-e is for password input (this isn't the part I was talking). I set the password to test1234.
When I unzip the file I try things like this:
printf 'test1234\n' | unzip test.zip
But it still asks for password input.
Any suggestions?
If you are using the Linux command line, try using echo.
echo 'test1234' | unzip test.zip
Use the -P argument
unzip -P <password> <zipfile>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
After running a bad command my computer generates folders that start with "--". When I run ls I get something like:
workspace
--workspace
I don't know how to delete these folders through the command line.
rm -r --workspace does not work. I only have access to this machine through CLI so I can't delete them using the gui.
My OS is Linux 18.04
You need to tell rm to stop parsing and use your arguments verbatim. You do this by passing a final -- argument before the file or folder name.
rm -r -- --workspace
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
Running a grep command on my file gives me the following output:
15-5-65
52-5-93
51-4-82
21-0-86
54-6-09
63-2-68
26-7-85
24-9-46
16-7-59
81-5-42
31-7-63
54-0-84
69-8-80
74-1-27
19-9-86
41-8-74
13-2-03
21-3-61
56-7-60
81-9-47
I want to use each of these as a partial input to another grep command, such as grep '02729-AS-27' maps/projects.dat | grep '...-...' circuit_(pipe input).dat How do I properly format this command?
If this isn't clear, the files I want to search are called for example circuit_81-5-42.dat with numbers corresponding to the output of the first grep command above.
I hope this is what you want:
while IFS= read -r line; do
grep "...-..." "circuit_${line}.dat"
done < <(grep "02729-AS-27" "maps/projects.dat")
Or:
grep "02729-AS-27" "maps/projects.dat" | xargs -i grep "...-..." "circuit_""{}"".dat"
Please replace the pattern ...-... with the appropriate one.
Hope this helps.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have list of files which ends with -live.conf.
e.g.
admin-live.conf
user-live.conf
Above files should be renamed to:
admin-dev.conf
user-dev.conf
please help me how can I achieve with single command.
this is rename stand-alone utility by perl package.
usage :-
rename -n -v 's/live.conf/dev.conf/' *
Proper find + bash solution:
find . -type f -name "*-live.conf" -exec bash -c \
'dir_n=${0%/*}/; fn=${0##*/}; mv "$0" "$dir_n${fn/-live/-dev}"; ' {} \;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am trying to run a shell command in VIM using "exe." I have a variable that contains the result of a system call (a pathname)
tempName=system('run.sh') "tempname is actually equal to "/path/to/file/tempfile.do"
I want to use the variable tempName in another shell command:
exe '! cat '.tempName.' >> anotherFile'
So what should run is:
cat /path/to/file/tempFile.do >> anotherFile
but for some reason the " >> anotherFile" part is cut off and only
cat /path/to/file/tempFile.do
is running. I tried escaping the ">>" characters and the "." which did not work. Any ideas?
Does it work when you type it literally?
:execute '!cat /path/to/file/tempFile.do >> anotherFile'
If so, then the problem is that system() captures the output including the newlines.
One solution is to strip the final newline using substitute():
:execute '!cat '.substitute(tempName, '\n$', '', '').' >> anotherFile'
This works for me. Note the space after cat
:exe '! cat '.tempName.' >> anotherFile'