Search Results

Search: Posts Made By: Franklin52
10,143
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.
10,143
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
1,478
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
3,679
Posted By Franklin52
Try this: awk 'NR % 6 {printf $0 FS; next}1' ...
Try this:
awk 'NR % 6 {printf $0 FS; next}1' file
3,169
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
1,241
Posted By Franklin52
Please show what you have tried so far.
Please show what you have tried so far.
1,396
Posted By Franklin52
Thread closed, continue here: ...
Thread closed, continue here:

https://www.unix.com/linux/255080-small-problem.html
1,157
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) }'
1,312
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.
1,312
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
6,492
Posted By Franklin52
With awk: awk '!p{p=sub("2Z694-00609",x)}1'...
With awk:
awk '!p{p=sub("2Z694-00609",x)}1' file
3,070
Posted By Franklin52
I'm sorry, the first command should be: ...
I'm sorry, the first command should be:
newvar=$($var1 | awk '{print $1}')
22,990
Posted By Franklin52
Indeed :D
Indeed :D
5,010
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...
5,413
Posted By Franklin52
Something like this? ls -l 1*
Something like this?
ls -l 1*
3,819
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
3,047
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
3,047
Posted By Franklin52
Something like this? awk '/RC...
Something like this?
awk '/RC No/{close(f);f=$4}{print >> f}' test.txt
3,047
Posted By Franklin52
Or maybe something like: awk...
Or maybe something like:
awk '/^TD/{close(f);f=$2}{print >> f}' file
4,569
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,996
Posted By Franklin52
awk '{$1=$1}1' RS= file
awk '{$1=$1}1' RS= file
Forum: Programming 03-05-2014
2,344
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
2,344
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,996
Posted By Franklin52
Try this: awk '$1=$1' RS= file
Try this:
awk '$1=$1' RS= file
2,532
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

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