Skip to content
Advertisement

Tag: bash

How do I replace single quotes with another character in sed?

I have a flat file where I have multiple occurrences of strings that contains single quote, e.g. hari’s and leader’s. I want to replace all occurrences of the single quote with space, i.e. all occurences of hari’s to hari s all occurences of leader’s to leader s I tried and but they are not giving me the expected result. Answer

check if file is open with lsof

I’m using linux mint 13 xfce and I have a file named wv.gold that I’m trying to check in bash if it’s open by any program (for instance, I opened it in sublime-text and gedit) In many forums people say that if I run lsof | grep filename I should get 0 if it’s open or 256(1) if it’s closed,

Take nth column in a text file

I have a text file: I want to take the 2nd and 4th word of every line like this: I’m using this code: It works, but it is very complicated and takes a long time to process long text files. Is there a simpler way to do this? Answer iirc : or, as mentioned in the comments :

How does cmd > /dev/null 2>&1 work?

I’m reading up on redirecting data to /dev/null and so I tried a simple test: If I try this: However, if I do this: That last solution is the desired solution, but what is happening with this 2>&1? My research so far suggest that 2 represents stderr and 1 represents stdout. So if I read it that way, it looks

Terminal edit command in a editor [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 9 years ago. Improve this question I am coming from the postgres world, and am not very new to UNIX. My question is, if there is a way to invoke a editor from command

Find the files existing in one directory but not in the other [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 Exchange site, you can leave a comment to explain where the question

Insert into mysql from linux terminal

I have a question. i can insert into mysql database from linux terminal a record with this command: Now i have a file in Linux with some records for example: i don’t know how can i insert all records to the file to mysql database from linux terminal. I intent with a bash file but i don’t know =( Answer

subversion pre-commit hook error code 255

I added pre-commit hook script to the repository. It always gives below error while committing: I have already checked that my pre-commit script is having executable permission and its a bash script. is added in the beginning of the file. Even if I write in the beginning of the file, it is not allowing me to commit and giving the

Advertisement