Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: Yoda
2,889
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,...
5,391
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%%=*}"
...
4,548
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)

...
1,353
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...
3,597
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...
2,116
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)
...
2,838
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
8,749
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))
1,744
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
7,611
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
2,981
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...
1,299
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
586
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...
616
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...
1,032
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...
743
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...
743
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
757
Posted By Yoda
Ok, escape it:- sub ( /[^\/]*\//, X, $i )
Ok, escape it:-
sub ( /[^\/]*\//, X, $i )
2,455
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] +=...
971
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
829
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
5,120
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
930
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...
1,553
Posted By Yoda
Another approach using awk:- awk -F\| '{NF=4}1'...
Another approach using awk:-
awk -F\| '{NF=4}1' OFS=\| file
701
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

 

Featured Tech Videos

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