Search Results

Search: Posts Made By: Jotne
1,514
Posted By Don Cragun
Anytime you reset a numbered field (such as $2=x...
Anytime you reset a numbered field (such as $2=x or sub(regex, replacement, $n)) for n not equal to 0), $0 is recalculated. For the general case, you could try something like:
( printf " 2 4 6\n"...
21,197
Posted By Don Cragun
In addition to what has already been said, you're...
In addition to what has already been said, you're not looking for a field separator, you're looking for a field fill character. There are several ways to do this, here are two:
awk...
1,416
Posted By Scrutinizer
Try: awk '{gsub(/,/,"_",$1)}1' FS=XX OFS=XX...
Try:
awk '{gsub(/,/,"_",$1)}1' FS=XX OFS=XX file
946
Posted By Don Cragun
When FS is set to a space character, leading and...
When FS is set to a space character, leading and trailing spaces and tabs are removed from the input line and then any sequence of one or more space and tab characters act as field separators. When...
2,316
Posted By alister
I am no longer competent on Linux (it's been more...
I am no longer competent on Linux (it's been more than 5 years since I used it regularly), but perhaps this will provide more specific information than the simpler ip route?
ip route get <addr>...
888
Posted By MadeInGermany
Placing the conditional print (p or p!=0 {print})...
Placing the conditional print (p or p!=0 {print}) after the conditional {p=0} and before the conditional {p=1} saves a next
awk '/END-OF-DATA/{p=0} p; /START-OF-DATA/{p=1}' file
In general it's...
2,100
Posted By rdcwayx
awk '{printf (/^\|/)?$0:RS $0}' infile
awk '{printf (/^\|/)?$0:RS $0}' infile
3,057
Posted By bartus11
Jotne, post output of:cat -ev a.txt cat -ev...
Jotne, post output of:cat -ev a.txt
cat -ev b.txt
968
Posted By MadeInGermany
awk '{print s1,"a.directory from",e $0 e; s1=s2}'...
awk '{print s1,"a.directory from",e $0 e; s1=s2}' s1="root" s2="bin" e="'" input.txt
1,413
Posted By RudiC
Try alsoawk '/Hello/ {L=NR+2} NR==L {print $2}'...
Try alsoawk '/Hello/ {L=NR+2} NR==L {print $2}' file
123
543
7,136
Posted By alister
You are mistaken. Explicit looping can be...
You are mistaken. Explicit looping can be implemented with labels ( : ) and either or both of the branching (b) and testing (t) commands. However, a sed solution does not require any explicit...
1,441
Posted By DGPickett
grep ...|wc -l = grep -c ...
grep ...|wc -l
=
grep -c ...
1,441
Posted By DGPickett
I use "ls -A" to see hidden files not . or .. as...
I use "ls -A" to see hidden files not . or .. as well as visible files. If you want to see only hidden, You can say "ls .??*z" as long as there are no short names, or "ls -A | grep '^\.' ". With...
1,267
Posted By nag_sathi
Hi All, The issue happened due hashbang(#!)...
Hi All,

The issue happened due hashbang(#!) not defined at first line, now i modified and placed in first line. Its working in cron

Thanks.
9,189
Posted By MadeInGermany
Note that 1. !$3 also replaces fields with 0 or...
Note that 1. !$3 also replaces fields with 0 or 00,
while 2. $3~/^$/ only replaces empty fields.
We had a discussion in another thread about $3=="" that IMHO should be equal to 2.
But Solaris...
1,285
Posted By Don Cragun
Note that this form will use up a file descriptor...
Note that this form will use up a file descriptor for every input file processed. Many awk implementations will run out of file descriptors if this script is given more than about 18 files.

If...
2,087
Posted By Chubler_XL
Slight change to simplify and remove blank fist...
Slight change to simplify and remove blank fist line:

awk '/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]/{if(s)print s;s=$0;next} {s=s" "$0} END {print s}'
17,173
Posted By Yoda
Jotne, please calm down. I noticed before that OP...
Jotne, please calm down. I noticed before that OP opened several similar threads, hence I requested him/her to refer another thread for ideas.

You can check my previous post.

But OP had some...
1,686
Posted By vidyadhar85
Completely agree with you, However as you know...
Completely agree with you, However as you know writing c or if(c) will take same number of CPU cycles to evalute it so its not going to make any proformace issues as far as this holds good I prefer...
1,709
Posted By Yoda
My 2nd suggestion should work with some minor...
My 2nd suggestion should work with some minor changes:
awk -F'[<>]' ' /col2/ {
cf = 1
} cf == 1 && c <= 8 {
++c
for ( i = 3; i <= NF; i += 2 )
{
...
12,154
Posted By Don Cragun
You're fortunate. When working with computers,...
You're fortunate. When working with computers, 24 hour time makes processing much easier; having to convert to and from human readable form in locales that use AM/PM is a frequent source of errors. ...
1,883
Posted By Scrutinizer
The only meaningful difference is with the ~...
The only meaningful difference is with the ~ operator (/ .. / cannot be used with the == operator )
There is a difference between " .. " (string interpreted as ERE) and / .. / (ERE constant)
...
2,830
Posted By mlbx01
You can use the interactive cron trainer at...
You can use the interactive cron trainer at http://www.dataphyx.com to play with crontab timing values. Put in any combination of time/date values and get back a list of future run-times.
4,163
Posted By elixir_sinari
Any pattern in awk expects the corresponding...
Any pattern in awk expects the corresponding action to start on the same line as that of the ending pattern line. If no action is found on that line, the default action (print current record) is...
2,425
Posted By radoulov
I'll try to explain the script. func...
I'll try to explain the script.

func buildrec() {
if (match($0, />[^<]*<\//))
rec = length(rec) ? rec OFS substr($0, RSTART + 1, RLENGTH - 3) : \
substr($0, RSTART + 1, RLENGTH - 3)...
Showing results 1 to 25 of 61

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