Skip to content
Advertisement

Tag: awk

Remove ” and n using sed

How to replace the below text using sed or in any other method. I need to replace the above to be like Answer A or . needs to be escaped in regex pattern. You may use this sed: You may consider this awk to remove ” and n characters anywhere in the file:

AWK to print subnet 0.69.100.in-abc.def

My requirement is to print a subnet 100.69.0.0/10 value to 0.69.100.in-abc.def. I tried as below but i got output like this How to get output using awk as below Answer Good attempt and you were close, try following. With OP’s approach we need to put [ and ] as field separator too, so that we could catch the exact needed

In bash how to move row field to column in a text file

I have a .txt file with this record: I would like to convert them like that: I have tried something like: or like but i can’t get it to work I would like the values to be transposed and that each tuple of values associated with a specific field is aligned with the others Any suggestions? Thank you in advance

Filter out number from a specific line in log file

I have got a log file with specific String Need to get the specific number which is at the end of line. We can use awk or grep , not able to get this using below command. Since the log file has timestamp at the beginning. Answer Awk lets you easily grab the last element on a line. The variable

A confusion about the alias area of bashrc file

I want write my own alias called oepnserver. The functions of the oepnserver are: show my ip address use python module to start a server on current folder. The detailed code is listed below: When I type oepnserver, my terminal only shows: However, my expectation was I also try to use the ifconfig wlan0 |grep inet |awk ‘{print $2}’ along,

How do I tell awk not to make any changes to an empty row

I have a dataset with three columns that look like this: I want to subtract a certain number from each entry in the second column and I know how to do that. But with how the data looks, I end up getting an output that looks like this: How do I prevent awk from adding that extra “-0.1” in the

How do i extract some particular words from each line?

The text file has many lines of these sort , i want to extract the words after /videos till .mp4 and the very last number ( shown in bold ) and output each filtered line in a separate file Lets say for example the text file content is .. The output should be Answer You may try the below regex:

Advertisement