Skip to content
Advertisement

Tag: shell

How to append text to a specific lines in a file using shell script?

I have a text file (file.txt) having content something like: It contains the process and respective PID. Using shell script, I want to append a string (running/not running) to that lines in this file, according to the PID. For example, in the above file, for line containing PID 3696, I want to append a string “running” at the end, so

Bash terminal and color output [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 10 years ago. Improve this question I have a shell with colors enabled: somefile contains escape characters for coloring. Now I want to output somefile to the terminal with its coloring. I tried: But

Bash while read loop extremely slow compared to cat, why?

A simple test script here: When I do cat my450klinefile.txt | myscript the CPU locks up at 100% and it can process about 1000 lines a second. About 5 minutes to process what cat my450klinefile.txt >/dev/null does in half a second. Is there a more efficient way to do essentially this. I just need to read a line from stdin,

wget: Unsupported scheme on non-http URL

I have the following line in my shell script: When I tried to run the script it give me the following error: Does it mean wget supports http and ftp ONLY? Answer man wget shows: It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Try curl, it supports file URLs. Also note you probably want

Shell script for remote SSH

I’m new to shell scripts, and I have centos running. I want to write a shell script that ssh a remote machine and execute a bunch of commands. The problem I’m facing is how to provide the username, the password, the remote machine address, and the private access key to a command that shall connect the remote machine. I’ve Google’d

Interacting with a .db file from Linux shell

I recently installed minidlna, a lightweight UPnP server, on my Raspberry Pi. Since this lacks the web interface of other programs such as Mediatomb, I thought it could be an interesting project for me to write one. I believe minidlna stores library information in a single file named “files.db”. EDIT: I was advised to check the output of file files.db

Advertisement