Search Results

Search: Posts Made By: John K
1,784
Posted By John K
Thank You Rudic The 2 solutions you've provided...
Thank You Rudic
The 2 solutions you've provided for the full-blown spec have one minor issue. The word "file" is also printed as the shown the output
But, I just need the filepath name

sed...
1,784
Posted By John K
awk '{print $2}' <fileName> did the trick I...
awk '{print $2}' <fileName> did the trick
I didn't know that a pathname like /usr/share/icons/Papirus/16x16/actions/address-book-new.svg will be considered a single column

So, i just got the...
1,784
Posted By John K
Extract filepath names between two strings
OS : Fedora Linux 26
Shell : bash

I have a file with around 5000 lines like below.

file /usr/share/icons/Papirus/16x16/actions/papirus-icon-theme-20180501-1.noarch conflicts with file ......
3,541
Posted By John K
Trying to remove leading spaces
OS : RHEL 6.7
Shell : bash

I am trying to remove the leading the spaces in the below file


$ cat pattern2.txt
hello1
hello2
hello3
hello4


Expected output is shown below.
...
1,192
Posted By John K
Thank You very much Ravinder It works really...
Thank You very much Ravinder
It works really well for my above requirement.


What if I have few words after the table name like the WHERE clause below.
Your above solution will not work for...
1,192
Posted By John K
Appending a text to the top of each line
Platform : Oracle Linux 6.8
Shell : bash

I have a file which has lines like below. These are SELECT queries (SQL)

In each line, I want the word just after FROM keyword to be copied and printed...
5,770
Posted By John K
Thank You Rudic. One more question. Any...
Thank You Rudic.

One more question.
Any idea how I can get the below for loop to work in bash ?
I want to fetch each value from history | awk '/sqlplus/ {print $1}' command output and then run...
5,770
Posted By John K
Why is my cut command not working ?
OS : RHEL 6.8
Shell : bash


I want to remove all lines like below from the history output as it has password.


$ history | grep sqlplus
239 sqlplus jn_usr/dxc825#@10.5.12.106/OCSGPD
...
4,144
Posted By John K
Hi jgt, No such -r option for du command in...
Hi jgt,
No such -r option for du command in RHEL 6.X or 7.X
4,144
Posted By John K
Sort by file/directory size
OS : RHEL 6.6

I want to list the files/directories sorted (Ascending or Desceding) by their size.

As you can see in the below example, du command doesn't sort by size.
In Linux world, is there...
1,927
Posted By John K
Delete patterns matching
Delete patterns matching


OS version: RHEL 7.3
Shell : Bash

I have a file like below (pattern.txt). I need to delete all lines starting with the following words (words separated by comma...
9,064
Posted By John K
Thank You Durden. Where can I read more...
Thank You Durden.

Where can I read more about "\s" ? What is this operator called ? (So that I can google about it )
9,064
Posted By John K
Thank You scrutinizer. :g/^ *#/d cannot take care...
Thank You scrutinizer. :g/^ *#/d cannot take care of TABs.

ie. It cannot remove the line with #some comment1 shown below which has a TAB at the beginning. Any idea , how lines with TABs can also...
9,064
Posted By John K
Delete all lines starting with # character
Tool used : VIM editor that comes with RHEL 7.4

I have a file like below. It has around 300 lines like below. All the lines starting with # are comments.
For readability, I removed all lines...
1,902
Posted By John K
Thank You rdrtx1. I forgot to mention, that I...
Thank You rdrtx1.
I forgot to mention, that I need to remove the dots as well (as shown in the Expected output).
But, I can live with your solution (ie. I can easily remove the dots using vi )....
1,902
Posted By John K
Remove prefixes before dot
Shell : Bash shell

I have a text file with entries like below

srv.sr_num sr_number, atvx.ATTRIB_37 Product_Name, ktx.X_ATTRIB_52 Product_Type, mkx.created sr_created_date, nbv.sr_cat_type_cd...
4,050
Posted By John K
Thank You for the brilliant demo , Ravinder. ...
Thank You for the brilliant demo , Ravinder.

I didn't know that awk can have multiple field delimiters . So, -F"'|;" means , the field delimiter can be either a single quote or a semicolon .
Why...
4,050
Posted By John K
Thanks Ravinder. So, in your solution, you are...
Thanks Ravinder. So, in your solution, you are asking awk utility to start reading from right to left . Right ? ( $6 being the first field)
4,050
Posted By John K
Hi Ravinder, Thank You. What is $6 ? Hi...
Hi Ravinder,
Thank You. What is $6 ?

Hi Rudic,
Thank You. What does NF do ?
4,050
Posted By John K
Copy a string to another file
OS version: RHEL 6.7
Shell : Bash

I have a file like below. It has 500K lines.
I want to extract TAG_IDs shown in single quote at the end to copied to another file. As if I had copied the...
7,128
Posted By John K
Grep all lines with the pattern .sh
Linux version : Oracle Linux 6.5
Shell : bash


In the the below text file (someString.text), I want to grep all lines with .sh in it. ie. Only the lines mysript.sh and anotherscript.sh should be...
3,021
Posted By John K
Convert text to lower case except the strings within single quotes
Shell : bash that comes with RHEL 6.7

I have SQL scripts like below. I want to convert all the text in these files to lower case except the strings enclosed within single quotes .
Any idea how I...
1,504
Posted By John K
Thank You Cero. So, If I use shebang (...
Thank You Cero.
So, If I use shebang ( #!/bin/bash as the first line) in the script itself, I don't need to place sh before the script name to execute it.Right ?
1,504
Posted By John K
Should I run scripts like sh /absolute_path/to/scriptname.sh or just /absolute_path/to/scriptname.sh
Shell : Linux Bash
OS version : RHEL 6.X, Oracle Linux 6.X

Question1. To execute shell scripts, sometimes I see Linux admins placing sh command before shell scripts like below

sh...
8,551
Posted By John K
Print asterisk instead of password (Bash)
OS : RHEL 6.5
Shell : Bash

With the following bash shell script, when I enter password, it won't be printed in the screen.
But, I would like Asterisk character to be printed instead of the real...
Showing results 1 to 25 of 98

 
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy