Search Results

Search: Posts Made By: Yoda
2,816
Posted By Yoda
Here is an approach using nawk by checking each...
Here is an approach using nawk by checking each character:-
nawk '
{
for ( i = 1; i <= length; i++ )
{
c = substr($0,i,1)

...
2,656
Posted By Yoda
Here is one approach using awk:- awk -F= ' ...
Here is one approach using awk:-
awk -F= '
/section/ {
sc = $1
S[sc]
next
}
/^VALUE/ {
A[sc FS $1] = $0...
874
Posted By Yoda
Your data appears to have variable number of...
Your data appears to have variable number of columns. The code you wrote will work if all rows in your input file has exactly three columns.

But if that is how your input data is, then one...
1,218
Posted By Yoda
I suppose then your input is not tab delimited,...
I suppose then your input is not tab delimited, try:-
awk '
NR == FNR {
A[$1] = $0
next
}
$1 in A {
split(A[$1], T)
...
Forum: Programming 09-18-2019
4,455
Posted By Yoda
To see the output from program, you have to print...
To see the output from program, you have to print the output. I believe stdout is used internally for this function:-

print subprocess.check_output(shlex.split(command))
2,239
Posted By Yoda
You have to use a LOOP to fetch and print all of...
You have to use a LOOP to fetch and print all of them:-

BEGIN
OPEN C1;
LOOP
FETCH C1 into KS_UID;
EXIT WHEN C1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(KS_UID);
END LOOP;
CLOSE C1;
END;
/
3,642
Posted By Yoda
Using built-in parameter substitution...
Using built-in parameter substitution (https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/osmanagement/korn_shell_parmsub1.html):-

while read line
do
SOME_VAR="${line%%=*}"
...
1,273
Posted By Yoda
Variable name is case sensitive:- awk ' ...
Variable name is case sensitive:-
awk '
BEGIN {
print "<table>"
}
{
print "<tr>"
for ( i = 1; i <= NF; i++ )
...
Forum: What is on Your Mind? 09-06-2019
4,071
Posted By Yoda
This discussion forum was really instrumental in...
This discussion forum was really instrumental in helping me broaden my understanding about *nix systems.

I like to thank every Advisors and Moderators for their great efforts. Keep up the good...
Forum: Red Hat 04-22-2019
1,439
Posted By Yoda
Here are the different process state codes and...
Here are the different process state codes and description:-

D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to...
907
Posted By Yoda
Using shell built-ins:- while read line do ...
Using shell built-ins:-
while read line
do
for file in ${line//:/ }
do
print $file
done
done < data.txt

OR
tr ':' '\n' < data.txt
468
Posted By Yoda
Note that = is an assignment operator. It assigns...
Note that = is an assignment operator. It assigns the value of right side expression to left side.

But == is an equal to operator. It compares the value of both sides. Hence you have to use == in...
552
Posted By Yoda
The reason is when you pipe the file to a while...
The reason is when you pipe the file to a while loop, it actually gets executed in a sub-shell:-
cat $1 | while read line
So the scope of the variable sum value is within the while loop. This is...
851
Posted By Yoda
$(< filename ) - shell opens the file. $( cat...
$(< filename ) - shell opens the file. $( cat filename ) - cat opens the file.

Create a simple script:-
#!/bin/ksh -xv

var1=$( cat file )
var2=$( < file )
and run strace to understand the...
646
Posted By Yoda
sprintf is an awk string function. For further...
sprintf is an awk string function. For further reference check: String Functions
(https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html)sprintf(format, expression1, …)
Return...
646
Posted By Yoda
Try using character class...
Try using character class (https://www.gnu.org/software/gawk/manual/html_node/Bracket-Expressions.html) [:alnum:] - Alphanumeric characters:-
awk '!/[:alnum:]/{$1=sprintf("%.3f",$1)}1' file
676
Posted By Yoda
Ok, escape it:- sub ( /[^\/]*\//, X, $i )
Ok, escape it:-
sub ( /[^\/]*\//, X, $i )
1,873
Posted By Yoda
Here is an awk approach:- awk ' BEGIN...
Here is an awk approach:-
awk '
BEGIN {
n = split ( "A B C D", T )
}
{
for ( i = 1; i <= NF; i++ )
R[i FS $i] +=...
751
Posted By Yoda
Ok, replace below line in your code:- while...
Ok, replace below line in your code:-
while IFS= read -r LINE; do
to
while read LINE; do
711
Posted By Yoda
Using nawk:- nawk -F, '$4>=23&&$4<=25{$1="b"}1'...
Using nawk:-
nawk -F, '$4>=23&&$4<=25{$1="b"}1' OFS=, file
544
Posted By Yoda
I guess this is happening at the email client. ...
I guess this is happening at the email client.

E.g. Microsoft Outlook by default removes extra line breaks in plain text format. You will be able to see a warning "We removed extra line breaks...
Forum: AIX 01-02-2018
3,808
Posted By Yoda
Also try running strace and check what is going...
Also try running strace and check what is going on:-
strace -o trace.out vi test.txt
1,136
Posted By Yoda
Another approach using awk:- awk -F\| '{NF=4}1'...
Another approach using awk:-
awk -F\| '{NF=4}1' OFS=\| file
625
Posted By Yoda
Here is what I get. Note that the sequence of...
Here is what I get. Note that the sequence of input files matters:-
$ cat file1
frame1,dummy,server1, 00C1C N/A RDF1+TDEV RW 51789
frame1,dummy,server1, 00C1D N/A RDF1+TDEV RW 51789...
858
Posted By Yoda
sed 's@\(queen_[^)]*\)\([)]\)@\1\2#1@' file
sed 's@\(queen_[^)]*\)\([)]\)@\1\2#1@' file
Showing results 1 to 25 of 500

 

Featured Tech Videos

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