I am new to scripting. Is it possible to export the disk space usage of a linux server to an excel shell(.csv) sheet daily ? If so, what will be the scripting for that? Answer Use awk to parse df result: Assuming ; is your csv separator, then: gives: In a full script with the date:
Tag: shell
Get return value of command run in background with pipe and tee command
I want to get the return value of command run in background with pipe so i have below sample code. Output: If i echo the return value from same command then it print correct return value. But if store it in RETVALUE variable then it shows wrong value. Answer The problem is due to the & sign. This puts the
Bash: Read in file, edit line, output to new file
I am new to linux and new to scripting. I am working in a linux environment using bash. I need to do the following things: 1. read a txt file line by line 2. delete the first line 3. remove the middle part of each line after the first 4. copy the changes to a new txt file Each line
Download github release with Java/Shell
I want to be able to download a github release (a jar file) and put it in a certain directory on my VPS (running Ubuntu 16.04). How would you go about doing this? Adding the “shell” tag as I think you’d need to use shell Answer See this discussion: Download single files from GitHub In the past, I’ve used something
partial merging 2 text file in linux
I have 2 text file which I want to merge them in a new file. my first file is look like and second file = and my expected output like, I mean mapping part of 9th column string from first line with 1st column of second file, should be like : Also, I wanted to keep line from first file
How can i generate the response file for my binary installable?
I have the binary file to install a component when i am running using ./filename.bin it comes into console mode and asks for language selection and directory selection and all , i tried ./filename.bin -r path/response.properties, help me if anyone knows. Answer as you said that you have already tried using ./filename.bin -r path/response.properties and still it does not work
Color information disappears when writing a result of ‘grep –color=auto’ into a file
When I do as below with an aliased grep(grep –color=auto) it returns abcde (ab in red). but foo.txt has just abcde. I guess my terminal shows ab in red in the 1st case according to some tags by ‘grep’ but foo.txt does not contain them. Is it due to grep? Does grep judge what returning value should be? My grep
Bash list datetime between two dates
How to list all datetimes in the format “+%Y-%m-%d %H:%M:%S” ? This only prints the dates, but I want the time included as well i.e. 2016-07-20 08:33:21 Answer Hope this one can help you: Output:
Is it possible to somehow undo the results of the mv command?
Here’s the problem. I had a bunch of files in a directory. Then I created another directory in that directory. Then I cobbled together this command: This command was supposed to take all the files in the directory and move them to that newly-created directory, but instead of providing the name of the directory, I screwed up and typed 1,
Concatenating file names into string for a function
I’m trying to concatenate a bunch of files into a string so I can use them for a function. As a test script I’m trying to do this: but I’m getting the error: but they are most definitely there can I get some advice please? Answer Change the last line to mv $A ./stuff That should work with files that