Search Results

Search: Posts Made By: Franklin52
9,760
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.
9,760
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,314
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,504
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,004
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,066
Posted By Franklin52
Please show what you have tried so far.
Please show what you have tried so far.
1,252
Posted By Franklin52
Thread closed, continue here: ...
Thread closed, continue here:

https://www.unix.com/linux/255080-small-problem.html
990
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,275
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,275
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,309
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,025
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,917
Posted By Franklin52
Indeed :D
Indeed :D
4,923
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,326
Posted By Franklin52
Something like this? ls -l 1*
Something like this?
ls -l 1*
3,750
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
2,976
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
2,976
Posted By Franklin52
Something like this? awk '/RC...
Something like this?
awk '/RC No/{close(f);f=$4}{print >> f}' test.txt
2,976
Posted By Franklin52
Or maybe something like: awk...
Or maybe something like:
awk '/^TD/{close(f);f=$2}{print >> f}' file
4,399
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,976
Posted By Franklin52
awk '{$1=$1}1' RS= file
awk '{$1=$1}1' RS= file
Forum: Programming 03-05-2014
2,265
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,265
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,976
Posted By Franklin52
Try this: awk '$1=$1' RS= file
Try this:
awk '$1=$1' RS= file
2,487
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 04:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy