Search Results

Search: Posts Made By: stew
1,181
Posted By bakunin
This is a bit unintuitive, but in fact it comes...
This is a bit unintuitive, but in fact it comes from the structure of the filesystem itself. Filesystems in UNIX (any UNIX filesystem i know so far) rely on "inodes", which hold the files metadata...
2,474
Posted By Don Cragun
The standards require that "standard utilities"...
The standards require that "standard utilities" have to be available as stand-alone utilities so you do things like:
find dir -exec utility arg... \;
The only utilities defined by the standards...
2,474
Posted By cero
Hi, on Debian Linux + Bash: type unset ...
Hi,

on Debian Linux + Bash:
type unset
unset is a shell builtin
1,909
Posted By sea
You are grep'ing for local/init.d/abc, but ls...
You are grep'ing for local/init.d/abc, but ls output is only abc, so it cant find it.
grep only for abc, and you should see output.
Also, your first code has no closing done.

Furthermore, you...
1,048
Posted By RudiC
man bash:
man bash:
2,230
Posted By RudiC
Don't pipe the echo, connect the two by either...
Don't pipe the echo, connect the two by either ANDing them:echo -n "kernel.sem = " && cat /proc/sys/kernel/sem
or a group command (compound command):{ echo -n "kernel.sem = "; cat...
11,864
Posted By Don Cragun
So why are you using awk for either of these? ...
So why are you using awk for either of these?

read x semmns < //proc/sys/kernel/sem
read shmmax < /proc/sys/kernel/shmmax
[ "$semmns" -lt 33000 ] && printf 'semmns: %d\n' "$semmns"
[ "$shmmax"...
13,008
Posted By radoulov
Try: LC_ALL=C tree
Try:
LC_ALL=C tree
1,435
Posted By Scott
It picks it from the first path it finds it in...
It picks it from the first path it finds it in (unless you specify a path when running it).

From the (shell) prompt, type:

which mv


For me, it's:

$ which mv
/bin/mv
10,988
Posted By Don Cragun
You need to use cp and rm if: there are...
You need to use cp and rm if:

there are multiple hard links to the file you are overwriting,
you need to preserve file modes that might be different from what would be set using your current...
10,988
Posted By Don Cragun
First, be sure that you have a back-up copy of...
First, be sure that you have a back-up copy of sysctl.conf before you try this. Then try something like:
nawk '
/kernel.sem/ {
if(($3 + 0) < 300)
sub($3, "300")
else exit(1)
}
1'...
10,988
Posted By RavinderSingh13
Hello Stew, Could you please try the same...
Hello Stew,

Could you please try the same and let me know if this helps, kindly try the same first with same details a test file
and if All is Well then you can try with actual file too.

cat...
10,988
Posted By anbu23
sub($1,"300",$0) - Sub() replaces first field by...
sub($1,"300",$0) - Sub() replaces first field by 300 in $0 (entire line read from file test)
10,988
Posted By anbu23
awk '{ if ($1 < "300") { sub($1,"300",$0); print...
awk '{ if ($1 < "300") { sub($1,"300",$0); print > "/tmp/test" } }' /tmp/test
1,443
Posted By shamrock
Store all hostnames in a file ("servers" for...
Store all hostnames in a file ("servers" for example)...

cat servers
aaaa
cccc
dddd

Run the awk script on "InputFile.txt" to get the desired output separated by criteria into different...
921
Posted By SriniShoo
Below code will append the below given 2 lines of...
Below code will append the below given 2 lines of data into the file FILE_PATH
FILE_PATH='/tmp/sample.txt'
cat - << 'EOF' >> ${FILE_PATH}
This is sample data in the file
Check the data
EOF

...
1,047
Posted By Akshay Hegde
{a[$1]=a[$1]?a[$1]"|"$3:$3} --> If array a with...
{a[$1]=a[$1]?a[$1]"|"$3:$3} --> If array a with index $1 contains some element then concatinate existing array element with current line $3 where separator between existing element and new element...
8,929
Posted By Don Cragun
Try: printf '1d\nw\n' | ed -s test.txtor: ed...
Try:
printf '1d\nw\n' | ed -s test.txtor:
ed -s test.txt <<-EOF
1d
w
EOF
2,583
Posted By RavinderSingh13
Hello, Could you please use the following...
Hello,

Could you please use the following code.


awk -F, '{print $1}' print_first_files_check12112


Output will be as follows.


01.02.2014
12.03.2014
01.02.0214



Thanks,...
1,939
Posted By Don Cragun
Try changing: ... }; if($2 !=...
Try changing:
...
};
if($2 != 'n') && NR > 1 { ...to:
...
}
$2 != "n" && NR > 1 { ...
1,125
Posted By anbu23
$ awk ' > BEGIN {FS=","} {sum=0; n=0;i=3 > ...
$ awk '
> BEGIN {FS=","} {sum=0; n=0;i=3
> while (i<=5) {
> sum+=$i;
> i++;
> ++n }
> print $0,"sum:"sum,"count:"n,"avg:"sum/n}' file
111,victor,48,12,36 sum:96 count:3 avg:32...
3,538
Posted By Scrutinizer
Try: awk '/ n /{print "insert into lastlogon...
Try:
awk '/ n /{print "insert into lastlogon values(" q $1 q ", " q $3 q ", "q $4 q", "q $5 q", " q $6 q ")"}' q=\' userreport.txt
or
awk '/ n /{print "insert into lastlogon values(" q$1q, q$3q,...
3,538
Posted By bakunin
There are a number of reasons why this will not...
There are a number of reasons why this will not work:

First, "INSERT INTO <tablename>" is not a valid statement, because there is nothing specified to insert into the table at all. If you haven't...
4,087
Posted By Akshay Hegde
Looks like you missed read in your program 2,...
Looks like you missed read in your program 2, message #16
4,087
Posted By Don Cragun
With the input file shown above, the simple way...
With the input file shown above, the simple way to get the output you requested is:
grep -e '^On since' -e '^Last login' input_file
Showing results 1 to 25 of 31

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