the find command is: I want to convert to: so my code (is doesn’t work): Answer What you are attempting cannot be solved in the general case with “classic sh” because you need your script to work correctly with directories named * or ‘”[ ]”‘, and plain old flat string…
Tag: shell
“sh: line 1: Moved: command not found” installing npm with curl | sh
I attempted to install npm on mac OSX Yosemite with the command: And I received the following message: Any suggestions on how to resolve this issue? Answer You’re missing the curl -L option to follow redirects. However, you don’t need to use this installation method anymore, npm comes with node an…
Finding difference between 2 directories in linux
Hi guys, dir1/subdir/file.txt dir2/subdir/nffile.txt when i tried with “diff -r dir1 dir2” it shows only the content difference in files but i want interns of new file addition. Any possibility that we can find the difference between these dir using the “diff” command. Answer Try out u…
How to call this shell script to convert mysqldump to SQLite compatible syntax
I need to autonomously convert mysqldump files (.sql file) to SQLite compatible .sql files. I found this script on github which is supposed to be able to do this. If I had an unmodified .sql file from MySQL called test.sql whose database’s name was test and the script mysql2sqlite.sh in a directory, how…
How to insert a new record(row or line) after the last line of input file using awk?
The marks of the students are given as a table in the following format Name | rollno | marks in exam1 | marks in exam 2 … i.e. There is one record per line and each column is separated by a | (pipe) character.At the end of all the records I want to add extra lines which contains information about
Grep out tags from git repo
Trying to sed out the different tags from my repo with shell: Returns, How can I grep out only the different tags as v1, v2, v3, v4: Answer What about good old grep and uniq :
manipulate column fields for clean representation
Hi I have data in txt file in following format I want to only extract IP address and bytes field, so final result should be Also at the end i want to group by bytes (3rd column) by first field. to get : Any help ? thanks Answer If you want to consider awk: EDIT: Based on comments below:
Using shell commands with boot2docker
I have created a boot2docker VirtualBox instance, I can SSH into it OK but then when I try and run any commands such as bash I get Pretty sure I’m missing something really simple but can’t see what. Looking in /bin it doesn’t look to contain bash I’m pretty new to the *nix world so be …
PostgreSQL CSV import from command line
I’ve been using the psql Postgres terminal to import CSV files into tables using the following which works fine except that I have to be logged into the psql terminal to run it. I would like to know if anyone knows of a way to do a command similar to this from the Linux shell command line similar to how
How to make a return from a child function cause a return to the parent function?
I have a parent function and child function: How to make the return 1 (of the child) cause a return in the parent and then avoid the execute the remaining child calls? without adding a check of the returned value after each child call like this Answer There is a solution other than set -e and || return ItR…