A few commands I tried are What can be going on? Is it because I use Notepad? Answer In short, yes. Notepad only understands DOS line-endings and not Unix line-endings. Use Wordpad or any other more capable editor to see the newlines correctly. Alternatively, if you do want to create DOS/Windows line-ending files then use rn in the printf call
Tag: shell
Grep a line then print awk until a certain substring
My code is But, I want to have $9-$20 be stopped when it hits a value like (0) or (1). This will make my output format and look a lot nicer because anything after (0) or (1) is garbage. Does anyone have an idea on a way to implement that? Input: Output: EDIT: THANK YOU TO ALL THE PEOPLE THAT
Using awk command to go through a text file and incrementing counters for morning, afternoon, and night sections of the script
I am using awk to go through a text file that has information of finished scripts then says complete (morning) then informaton of finished scripts then says complete (afternoon) then information of finished scripts then says complete (night). I am trying to keep track of the finished scripts for each block. The way I am doing it is… However the
Reading through a text file line by line and checking if that line has a certain string
I am trying to read a text file line by line using Shell Scripting. What I have been doing is If you have any suggestions please let me know! I am open to other options because I have been trying to do this way too long. TO CLARIFY: I am going through a file line by line (while loop) then
Add timestamp to R CMD BATCH outfile name
I want to run a script, and name the outfile. The default looks like this: How do I add a timestamp to the name? Something like this: Answer Couldn’t show backticks in the comments, see below:
Status after each argument passed to -exec in find
I’m writing a quick script to list all the files in a directory, run a function on each of them, and then print out the status code. Now the status code I would like is of the entire transaction and not the last expression that was executed. For example… Let’s say I have the following files file1.txt, file2.txt, file3.txt in
Executing a script from a parent directory?
I have a root directory. In there I have ./bin/ In ./bin/ I have some bash scripts like: These scripts must be ran from ./bin, that is, the working directory must be: however, I would like to do: That last line would set the working directory temporarily to ./bin/ and would execute my script found in ./bin and pass that
shell script to kill tomcat service if it is not stopped by stop command after certain amount of time?
I would like to write shell script to start and stop tomcat server.For stopping the tomcat I am using this command “./bin/shudown.sh” or “./bin/catalina.sh stop”. This is not working most of the times, tomcat is still running.So I would like to kill the tomcat after giving shutdown command and wait for sometime(say 5min). Can anybody help me how to do
How to handle missing values while calculating average in shell script?
I have a dataset with many missing values as double slash (//). Part of the data is I would like calculate the average in each 6 rows interval without considering the missing values. I was trying with this, but not getting what I need. It is giving But the answer should come Answer You need to modify the awk a
Use Xargs to wait for enter key
So, I have a list of files that I want to use to generate a new set of groups of files. I want to open up these groups (multiple files) together at once. Edit them. Then go back to the terminal, hit enter, and open up the next group of files. I’ve got it working, but I’m using a temporary