Search Results

Search: Posts Made By: Yoda
6,020
Posted By Yoda
One approach is to use a for loop to open one...
One approach is to use a for loop to open one file at a time, modify and redirect the output to a temporary file, rename the temporary file back to original file:-
for file in *.txt; do awk -F,...
8,132
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%%=*}"
...
8,325
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,309
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...
8,224
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...
3,311
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)
...
6,462
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;
/
Forum: Programming 09-18-2019
11,090
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,634
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
9,155
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
9,852
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...
3,934
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
1,168
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...
1,039
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...
7,982
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...
1,569
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...
1,569
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
1,538
Posted By Yoda
Ok, escape it:- sub ( /[^\/]*\//, X, $i )
Ok, escape it:-
sub ( /[^\/]*\//, X, $i )
5,393
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] +=...
2,255
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
1,861
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
Forum: AIX 01-02-2018
16,407
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
2,162
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...
2,094
Posted By Yoda
Another approach using awk:- awk -F\| '{NF=4}1'...
Another approach using awk:-
awk -F\| '{NF=4}1' OFS=\| file
1,808
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...
Showing results 1 to 25 of 500

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