Skip to content

linux terminal text manipulation

I am now studying linux command line and this question is in my head for almost a week but i think still i have not found optimal solution, question is next: i have file with is formatted in a bad way one word on each line: as you see those are linux distros with version and release dates right formatting

MYSQL insert into on duplicate key value

I have two tables X and Y. Both of them have the column ‘name’ in common. Columns of X are id(Auto increment) – primary key name email value. Columns of Y are id(Auto increment) – primary key name sex salary There are some rows in X which are not present in Y. I want to insert those mi…

Where is the official documentation for chmod?

I would have expected it to be here in the gnu documentation but it is not. So I Googled it and their were many links but I don’t know which one is the most “official”. For example the first hit is for an Ubuntu distribution, and the second is for a Mac OS X distribution. Answer On a typical…

Grep regexp for matching ip addresses in a file

I’m trying to search a file “Sessions” that contains IP addresses (among other useless junk). My Grep is failing to match, even though REGEXR is matching perfectly all the IPs perfectly … so I know the REGEX is correct … but when I GREP for this same pattern, not is returned. I&#…

Redirect all output of the java program to log file

I have scheduled my jar file by saving this line at the end of the crontab: Cron has started the job, also created the log file, but there is nothing in that file. Any idea why is that? I am doing System.out.println() in my program. I have added write permissions to everyone for that file. Could it happen tha…

Java Linux Terminal in JPanel

I am making a Scripting Editor and would like to be able to run the Bash/Shell/Python/etc. scripts in the program… So far, I have a way of running them, but there is no way for the scripts to have user input; here’s the code: Any help/ideas are greatly appreciated!!! Answer This is a modification …

Could not install mysql-server inside docker container

I want to configure a container with MySQL, thereafter I will add a java application to the container. But, I could not install MySQL-server inside the container. here is my dockerfile: I got the following error: Errors were encountered while processing: /var/cache/apt/archives/mysql-server-5.5_5.5.44-0ubuntu…

Bash – Delete lines ending with a number

I need to remove only lines (in text file) ending with a number. Before: After: Answer Since you’re referencing my favorite movie, I’ll answer: Which translates to: Delete any line where there is either a space or a tab, followed by at least one digit, then any amount of spaces or tabs at the end …