i need to extract oracle-xe-11.2.0-1.0.x86_64.rpm from oracle-xe-11.2.0-1.0.x86_64.rpm.zip and i have no clue how to start. The condition that must be met is only .zip needs to be removed. If there is no .zip then nothing should happen to the string . How to go with it ? Answer Use basename instead: Result:
Tag: awk
Calculate Median and Average of a Text FIle with Multiple Columns of Data
I have a file with multiple columns of data. I need to calculate the median and average of the two columns. Input: Desired Output: I have tried Which is good for only one column of data. Answer Here I’m assuming you meant to work with columns and calculate two sets of values. Your output format is not reflecting this assumption
How to grep a particular pattern
I am trying to get a particular pattern, but i get the result for all possible solutions I did try all the solutions available here How do I get only the PID: 467? Answer If your goal is to grep only for “lubuntu”, not “lubuntu-somethingelse”, then you can add a space afterwards: Or without the extra commands: Edit: If you
Obtaining UNIQUE VALUE occurrences count in a set of COLUMNS using AWK
IGNORING columns 1 & 2 (only the rest of the columns); I would like to obtain the occurrence COUNT of UNIQUE EVEN values (ignoring ODD ones) for the following set of data. I have tried: I obtain 76 but I don’t expect this value. Answer You can try this awk command to count unique values ignoring 1st and 2nd column:
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
Running awk command in remote host fails
I am running a shell script to run awk command on a remote host. The awk command runs fine locally, but when run for the remote host fails (the redirected file is empty): Here is the script run on remote host: smb.conf.tmp is empty in remote host !! Locally: I followed this link for awk running on remote host Answer
How to append entry the end of a multi-line entry using any of stream editors like sed or awk
I am trying to use a script to append the host name at the end of a multi-line entry of a specific Host_Alias field in sudoers file. The current sudoers file has an entry similar to : My required output would be something like the following where I have added “,host25” There are more lines before and after this segment.
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
searching through text file in terminal
Hi this might be a basic question for many, but it has however managed to eat a couple of hours of my time. I have large data file as an output from running a script. The file contains around 15 columns and around 100,000 rows. I wish to search through the file and in columns 4,5,6,7 and 8 check for