Search Results

Search: Posts Made By: John K
1,467
Posted By bakunin
I think the same as obviously RudiC does: perhaps...
I think the same as obviously RudiC does: perhaps the empty spaces are not what they seem to be (tabs instead of spaces or the like). Modify your code above to:

sed 's/^file[[:space:]]*//;...
1,467
Posted By RudiC
Not with the sed and file versions that I have: ...
Not with the sed and file versions that I have:
sed 's/^file \| conflict.*$//g' file
/usr/share/icons/Papirus/16x16/actions/papirus-icon-theme-20180501-1.noarch...
1,467
Posted By Scrutinizer
Note: The use of \| for alternation is a GNU...
Note: The use of \| for alternation is a GNU extension to BRE (Basic Regular Expressions) and is not supported in standard sed.
1,467
Posted By RudiC
Brilliant! Yes, it will do as long as there are...
Brilliant!
Yes, it will do as long as there are NO SPACES in the file names.
And, the file name is considered a single column as long as it doesn't have field separators in it, i.e. you don't...
2,934
Posted By rdrtx1
:1,$ s/^ *//
:1,$ s/^ *//
2,934
Posted By Don Cragun
To specify ex (or ed) commands in vi, you precede...
To specify ex (or ed) commands in vi, you precede the ex command with a :; not with a %. The ex substitute command s/[ ]*^//g is a request to replace string of 0 or more <space> characters that are...
965
Posted By ctac_
You can try this sed too sed...
You can try this sed too
sed '/^$/!{h;s/.*[Ff][Rr][Oo][Mm] \([^ ;]*\).*/PROMPT \1/;G;}' infile
965
Posted By RavinderSingh13
Hello John_K, Also adding to RudiC's point,...
Hello John_K,

Also adding to RudiC's point, you could use following command too in case your strings Where OR WHERE OR where could work by this command.

awk '{val=toupper($0);gsub(/.*FROM |...
965
Posted By RavinderSingh13
Hello John K, Could you please try following...
Hello John K,

Could you please try following and let me know if this helps you.


awk '{val=$0;gsub(/.*FROM | WHERE.*/,"",val);print "PROMPT",val ORS $0}' Input_file


Thanks,
R. Singh
965
Posted By RudiC
You could extend Ravindersingh13's proposal to ...
You could extend Ravindersingh13's proposal to
- work on upper and lower case keywords, both of which are allowed in SQL
- eliminate the trailing semicolon if where clause is missing
- keep empty...
965
Posted By RavinderSingh13
Hello John K, Could you please try following...
Hello John K,

Could you please try following and let me know if this helps you.

awk 'NF{gsub(/where.*|;$/,"");print "PROMPT",$NF ORS $0";"}' Input_file


Thanks,
R. Singh
5,284
Posted By Chubler_XL
I have been playing around with this and it...
I have been playing around with this and it appears that multi-line commands go into the history as a single command until you log off. As an example if you typed a command like:

while read...
5,284
Posted By RudiC
I'm a bit puzzled. Although I warned that the...
I'm a bit puzzled. Although I warned that the history offset may change during the operations, the numbers should be "in range".
I don't really like the idea of working on "moving targets". rdrtx1's...
5,284
Posted By rdrtx1
while [ -n "$(history | awk '/sqlplus/')" ] ; do...
while [ -n "$(history | awk '/sqlplus/')" ] ; do history -d $(history | awk '/sqlplus/ {print $1; exit}') ; done
5,284
Posted By RudiC
cut does not concatenate delimiters but increases...
cut does not concatenate delimiters but increases the field count for every single one it encounters. Try
history | awk '/sqlplus/ {print $1}'
Be aware that the history offset changes with history...
3,428
Posted By RudiC
How about du -sb * | sort -n
How about
du -sb * | sort -n
3,428
Posted By Kesavan
for finding directories of size bigger than 10k...
for finding directories of size bigger than 10k in current directory and below that.

find . -type d -size +10k | xargs du -sh | sort -rn
3,428
Posted By wbport
We call this script lz to sort by sizes.rev="" ...
We call this script lz to sort by sizes.rev=""
if [ $# -gt 0 ]
then
if [ $1 = '-r' ]
then
rev="r"
# echo $rev
shift
fi
fi
ls -l $* |grep -v "total " |sort +4n$rev -5 +8...
7,279
Posted By durden_tyler
It's a "metacharacter" or a "shorthand character...
It's a "metacharacter" or a "shorthand character class" in a regular expression.
Any book, blog or webpage on regular expressions should mention it.

Here's the Wikipedia page on regular...
7,279
Posted By MadeInGermany
I like this URL...
I like this URL (http://www.grymoire.com/Unix/Regular.html)
The \s is in chapter "Perl Extensions".
In Linux the perl extensions sneak into the BRE and ERE, but they are not standard.
I would use...
7,279
Posted By Scrutinizer
For regular vi you can enter a literal TAB...
For regular vi you can enter a literal TAB character through CTRL-V TAB.
So:

:g/^[ ^I]*#/d
Where ^I denotes the TAB character entered through CTRL-V TAB
7,279
Posted By durden_tyler
If you are using Vim (as per your 1st post...
If you are using Vim (as per your 1st post above), then Vim understands "\s" for whitespace. At least Vim versions 7 and higher.

Try:


:g/^\s*#/d
To check the version of your Vim editor, type...
7,279
Posted By Scrutinizer
The second is the more reliable. If there is...
The second is the more reliable. If there is space before the # comment characters, it is still a comment. Even more reliable would be to remove possible TAB characters as well
1,520
Posted By RudiC
Try also sed 's/[^., ]\+\.//g'
Try also
sed 's/[^., ]\+\.//g'
1,520
Posted By rdrtx1
awk '{for (i=1; i<=NF; i++) sub("^[^.]+[.]", "",...
awk '{for (i=1; i<=NF; i++) sub("^[^.]+[.]", "", $i); print $0}' infile
Showing results 1 to 25 of 132

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