Search Results

Search: Posts Made By: landossa
4,538
Posted By MadeInGermany
awk ' NR==FNR { # first file a[$1]=$2 #...
awk '
NR==FNR { # first file
a[$1]=$2 # store in array a, hash-indexed by $1
next # done first file
} # now remaining file
{ # print, append a[$8] if it exists
print ($8 in a) ? $0 FS...
4,538
Posted By Yoda
An awk approach: awk -F'[:,]' ' NR ==...
An awk approach:
awk -F'[:,]' '
NR == FNR {
if ( NR > 1 )
A[$1] = $2
next
}
{
if ( FNR == 1 )
...
4,538
Posted By Yoda
First of all I don't see any matching values in...
First of all I don't see any matching values in field 7. So I guess you want to match field 8 instead of field 7.

Also your final output does not make any sense!
field 1,field 2,field 3,field...
1,696
Posted By rdrtx1
try also: awk '!/:/ {sub("\n$", "", s); $0=","...
try also:
awk '!/:/ {sub("\n$", "", s); $0="," $1} {s=s $0 "\n";} END {printf s}' input
1,696
Posted By Akshay Hegde
You may try this also $ cat <<eof | awk...
You may try this also

$ cat <<eof | awk '{S=!/^[[:space:]]/? S RS $0 : S OFS $1}END{print S}' OFS=\,
User Account Control:
User Account Control:
User Account Control:
User Account Control:
...
1,696
Posted By Don Cragun
As long as there is only one word on indented...
As long as there is only one word on indented lines (as in your example), the following should work:
awk '
/^[[:space:]]/ {
o = o "," $1
next
}
{ if(o != "") print o
...
8,072
Posted By fpmurphy
Rather than use /var/tmp, the more common place...
Rather than use /var/tmp, the more common place to put lock files is in /var/run.

You also need a trap statement to remove the lock if somebody or something terminates the script.
...
8,072
Posted By bartus11
Create "lock file" when starting the script and...
Create "lock file" when starting the script and remove it after script is done, for example:
if [ -f /var/tmp/script.lock ]; then
echo "Already running. Exiting."
exit 1
else
touch...
Forum: Cybersecurity 06-07-2013
3,569
Posted By Corona688
If the encryption doesn't protect him, or he...
If the encryption doesn't protect him, or he learns better after you sell it to him, he will be very upset. So I'd try the key on drive (https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS)...
Forum: Cybersecurity 06-06-2013
3,569
Posted By verdepollo
Plus, it's never secure enough: ...
Plus, it's never secure enough:

http://imgs.xkcd.com/comics/security.png
Forum: Cybersecurity 06-06-2013
3,569
Posted By Corona688
Think about that. If the hard drive knows the...
Think about that. If the hard drive knows the secret needed to decrypt itself, so would anyone stealing that hard drive. It's like installing a steel security door then welding it open. What...
Forum: IP Networking 06-06-2013
3,991
Posted By Corona688
Hmm. You might be able to whitelist traffic...
Hmm. You might be able to whitelist traffic to/from those interfaces by putting blanket rules to catch them, before any others:

-A INPUT -i eth1 -j ACCEPT
-A OUTPUT -i eth1 -j ACCEPT

-A INPUT...
Forum: Red Hat 06-05-2013
2,646
Posted By verdepollo
There isn't any standard for this, but as a rule...
There isn't any standard for this, but as a rule of thumb you don't want to include anything under /opt and /home.

The reverse process (converting an ISO to a VM appliance) should be pretty...
2,149
Posted By jim mcnamara
links=$(ip link |grep eth[0-7] |cut -d " " -f...
links=$(ip link |grep eth[0-7] |cut -d " " -f 2|cut -d":" -f1` | tr -s '\n' ' ')
for i in $links
do
echo $i
done

Is that what you are asking -- not clear to me, so I guessed. The cut and...
Forum: Red Hat 06-04-2013
2,646
Posted By verdepollo
Ah, so you already have a VM image. There's...
Ah, so you already have a VM image.

There's indeed a way to convert a VM appliance into a bootable/installable ISO. quemu-img does exactly that.

I have never used it though, but I bet Google...
963
Posted By Yoda
Assuming you want to remove all assignment...
Assuming you want to remove all assignment operator from output:
awk -F'=' 'NR==FNR{A[$1]=$2;next}/\$/{sub(/\$/,x);if(A[$2]) $2=A[$2]}{sub("=",OFS)}1' file.set file.conf
963
Posted By Yoda
awk -F'='...
awk -F'=' 'NR==FNR{A[$1]=$2;next}/\$/{sub(/\$/,x);if(A[$2]) $2=A[$2]}1' OFS='=' file.set file.conf
18,934
Posted By Corona688
Oh, and my procmailrc of course: ...
Oh, and my procmailrc of course:

MAILDIR=/home/username/
VERBOSE=on

:0
mail/

Then you just need a cron entry to run the fetchmail executable once and a while and it will do the rest.
18,934
Posted By Corona688
fetchmail is the traditional solution for this. ...
fetchmail is the traditional solution for this.

My ~/.fetchmailrc:

poll mail.zzzzzzzz.com
protocol pop3
user print@zzzzzzzz.com
pass qqqqqqqq
mda "/usr/bin/procmail -m...
16,148
Posted By alister
You can easily do this with cut itself, using...
You can easily do this with cut itself, using standard functionality:
cut -d, -f 1,6-9,11-

Regards,
Alister
16,148
Posted By Chubler_XL
If your cut supports --complement then: cut -d,...
If your cut supports --complement then:
cut -d, --complement -f2-5,10 infile

Otherwise, try this:

awk -F, -vR="2,3,4,5,10" 'BEGIN{split(R,A,",");for(v in A) S[A[v]]=1}...
2,206
Posted By agama
I think this might do it: awk -F , ' ...
I think this might do it:


awk -F , '
NR == 1 { # capture list from the first line
for( i = 2; i <= NF; i++ )
pname[i-1] = $(i);
next;
}
{ ...
6,366
Posted By chihung
Whatever the data has whitespace, the only way to...
Whatever the data has whitespace, the only way to preserve is to double quote the field. Unless you can be for sure that there will be no white space in the field, otherwise I would recommend you to...
2,223
Posted By balajesuri
perl -F, -ane '($.==1)&&print; chomp ($line =...
perl -F, -ane '($.==1)&&print;
chomp ($line = $_); open I, "< file2";
for (<I>) {
@x = split /,/;
if ($F[2] eq $x[0]) {
print "$line,$x[1]\n";
}
}' file1
12,223
Posted By guruprasadpr
awk 'NR==FNR{a[$2]=$1;next}{print $0","a[$2];}'...
awk 'NR==FNR{a[$2]=$1;next}{print $0","a[$2];}' FS="," file2 file1

Guru.
Showing results 1 to 25 of 29

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