Search Results

Search: Posts Made By: Franklin52
3,737
Posted By Franklin52
The print command appends a newline after a...
The print command appends a newline after a string and the printf doesn't.
3,737
Posted By Franklin52
Another approach: awk -F\" 'BEGIN{print...
Another approach:
awk -F\" 'BEGIN{print "Cust-Number,Cust-Name,Cust-Town,Cust-Purchase"}
/hobby/ || !NF{next}
/purchase/{print $2; next}
{printf $2 ","}
' file
785
Posted By Franklin52
If your grep doesn't support the -A and the -B...
If your grep doesn't support the -A and the -B options you can try:
awk 'NR==FNR{if($0 ~ /error/){n=NR}next}FNR > n-4 && FNR < n+4' /home/file.txt /home/file.txt
1,466
Posted By Franklin52
Try this: awk 'NR % 6 {printf $0 FS; next}1' ...
Try this:
awk 'NR % 6 {printf $0 FS; next}1' file
1,488
Posted By Franklin52
Use double quotes instead of single quotes to...
Use double quotes instead of single quotes to expand the shell variables:
sed -n "/$FromTime/,/$ToTime/p" $logFile > new_log.log
643
Posted By Franklin52
Please show what you have tried so far.
Please show what you have tried so far.
580
Posted By Franklin52
Thread closed, continue here: ...
Thread closed, continue here:

https://www.unix.com/linux/255080-small-problem.html
581
Posted By Franklin52
With printf you can use the width trick,...
With printf you can use the width trick, something like:
date | awk '{ printf("%s %*s\n", $2, 2, $3) }'
611
Posted By Franklin52
The sub function replaces only the field and...
The sub function replaces only the field and preserves the field separators, $1="" or $1=x doesn't.
611
Posted By Franklin52
Try this: awk -F\| 'NR==FNR{i=$1;sub($1,x);...
Try this:
awk -F\| 'NR==FNR{i=$1;sub($1,x); a[i]=$0; next} $1 in a{print $0 a[$1]}' input2.txt input1.txt
2,388
Posted By Franklin52
With awk: awk '!p{p=sub("2Z694-00609",x)}1'...
With awk:
awk '!p{p=sub("2Z694-00609",x)}1' file
1,690
Posted By Franklin52
I'm sorry, the first command should be: ...
I'm sorry, the first command should be:
newvar=$($var1 | awk '{print $1}')
16,477
Posted By Franklin52
Indeed :D
Indeed :D
1,772
Posted By Franklin52
Sure. df -h | awk 'NF==1{f=$1;getline;$0=f FS...
Sure.
df -h | awk 'NF==1{f=$1;getline;$0=f FS $0} int($5) >=80 {print "CRITICAL\n" $1 " has reach " $5}' file

Explanation:

NF==1{f=$1;getline;$0=f FS $0} -> if the line has 1 field add the...
4,080
Posted By Franklin52
Something like this? ls -l 1*
Something like this?
ls -l 1*
1,186
Posted By Franklin52
This should be more efficient: awk -F"[# ]"...
This should be more efficient:
awk -F"[# ]" 'NR==FNR{a[$1]=$1;next}$NF in a {print $1, $2, a[$NF]}' list.txt testfile.txt
1,815
Posted By Franklin52
/^RC No/ - Matches the pattern at the beginning...
/^RC No/ - Matches the pattern at the beginning of the line
NF means the number of fields and $NF means the last field
1,815
Posted By Franklin52
Something like this? awk '/RC...
Something like this?
awk '/RC No/{close(f);f=$4}{print >> f}' test.txt
1,815
Posted By Franklin52
Or maybe something like: awk...
Or maybe something like:
awk '/^TD/{close(f);f=$2}{print >> f}' file
2,054
Posted By Franklin52
Everyone at the UNIX and Linux Forums gives their...
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and...
1,251
Posted By Franklin52
awk '{$1=$1}1' RS= file
awk '{$1=$1}1' RS= file
Forum: Programming 03-05-2014
1,005
Posted By Franklin52
Try to run the sql string like this: ...
Try to run the sql string like this:
DoCmd.RunSQL SQL_NEW
Forum: Programming 03-05-2014
1,005
Posted By Franklin52
The SQL string should be probably like: SQL_NEW...
The SQL string should be probably like:
SQL_NEW = "UDATE tblDataBuch SET Gedruckt = '" & CInt(blnVariable) & "' WHERE Gedruckt = 0;"
or
SQL_NEW = "UDATE tblDataBuch SET Gedruckt = " &...
1,251
Posted By Franklin52
Try this: awk '$1=$1' RS= file
Try this:
awk '$1=$1' RS= file
1,389
Posted By Franklin52
You can try something like: awk...
You can try something like:
awk '{for(i=1;i<=NF;i+=2)printf $i ":" $(i+1) FS}{print ""}' file
Showing results 1 to 25 of 493

 

Featured Tech Videos

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