Skip to content

Tag: linux

How to use sed command to replace the string in linux?

I have String like below . Basically I need to look for the last colon (:) and Replace everything after last colon(:) . Output for the above string : hd_ma_prod_customer_ro:*:123456789:replacedString By using sed how can I do this.Any one help me. Answer The following sed command will do what you want: What i…

E501 line too long (99 > 79 characters)

I execute a linux shell command using python. I get the below error for the line mentioned- Code: Im not sure how to format the line as its a Linux command. Answer Consecutive string literals (separated only by whitespace) are merged into one in Python. So:

finding number of occurences in large text file in linux

I have a 17 GB txt file and i cannot seem to load it via vim. Researched on solutions provided here. However i do not seem to understand them very well and i am not good with linux or perl. I understand i would have to use grep or something. I have tried up to this code but i cannot

ssh key gen Permission Denied [closed]

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 …

Embedding bash commands

I’m using virtualenvwrapper and trying to create a virtualenv using a version of python that’s not the default. What I’d like to do is: …But without the copy-paste. Is there a way to do this in one line? Answer is the correct way to write this as a one-liner. type is a POSIX standard u…

How to send image data over linux socket

I have a relatively simple web server I have written in C++. It works fine for serving text/html pages, but the way it is written it seems unable to send binary data and I really need to be able to send images. I have been searching and searching but can’t find an answer specific to this question which …

How to convert multiple letters to uppercase in vim?

I need to change all lowercase letters e, s, t, and a to uppercase letters in a text file in vim. I tried using :%s/e/E/g for all letters but I couldn’t find a better solution. I want to do it using the command, not via visual method. Answer Try this using %s.Capture the pattern first; and then change t…

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…