Skip to content
Advertisement

Tag: awk

Extract substring from string in linux

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:

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

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

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

Advertisement