Search Results

Search: Posts Made By: Manu1234567
2,644
Posted By alister
That code is an absolute mess. It's almost as if...
That code is an absolute mess. It's almost as if you're trying to make it difficult for us to help. The very, very least you can do is use sane indentation.

I didn't scrutinize it, but two things...
804
Posted By sea
If you by "value of the file through path" just...
If you by "value of the file through path" just mean the filename, then its:
var=$(basename "/path/to/file with spaces")
If you mean the content of the file, its:
content="$(cat...
1,681
Posted By Akshay Hegde
Awk solution you may try your files $...
Awk solution

you may try

your files
$ cat manu.txt
ffrs44frfrf
123.33.44.3
$ cat katty.txt
d4r4ff5rf5
123.44.32.4
$ awk '{i++;split(FILENAME,A,".");printf (i==1)?"Host"FS A[1] "{"RS...
7,007
Posted By Akshay Hegde
you have to use bc and you also need to check...
you have to use bc and you also need to check argument exist or not

try

#!/bin/ksh

check(){
if [ -z "$1" ];then echo "No user input exiting..";exit;fi
}

check $1

sum=0...
7,007
Posted By MadeInGermany
Your requirement is not quite clear. The...
Your requirement is not quite clear.
The following reads numbers of files from arguments, or from stdin if no arguments are provided.
The numbers in files or stdin can be placed in columns or rows...
10,237
Posted By RudiC
set -x sort file* + sort file file~ file1...
set -x
sort file*
+ sort file file~ file1 file1~ file2 file2~ file3 file3~ file4

sort takes any number of files to work upon (up to certain system limits). So, if unquoted,...
10,237
Posted By Akshay Hegde
you can use cat cat /path_to_file/*.type |...
you can use cat

cat /path_to_file/*.type | sort ........so on
2,857
Posted By Akshay Hegde
Dear I too confused :) if you want to use...
Dear I too confused :)

if you want to use it as variable do like this

my_new_ip_address=$( awk -F'.' '{m3=($3>m3)?$3:m3;m4=($4>m4)?$4:m4}END{print (m4>=254)?134 FS 123 FS m3+1 FS m4*0:134 FS...
5,244
Posted By RudiC
Do you read the answers to your thread?
Do you read the answers to your thread?
5,244
Posted By Scrutinizer
A different approach to the original question: ...
A different approach to the original question:
awk -F. '{n=256*$3+$4} n>m{m=n; ip=$0} END{print ip}' file*

output:
134.123.25.237
5,244
Posted By Don Cragun
Not exactly. The while loop is side effect of...
Not exactly. The while loop is side effect of the fact that awk reads a line from the input file and performs the actions associated with each set of conditions that match those conditions. So in...
5,244
Posted By CarloM
$m4 ==254 { m4=0; m3 = $m3 +1}In awk $ is used to...
$m4 ==254 { m4=0; m3 = $m3 +1}In awk $ is used to access fields, not variables - if m4 is 254, $m4 is a reference to (empty) field 254.

Also, consider what you want to do in this case if octet 3...
10,237
Posted By jethrow
ip=`head -n1 file.dat` # read ip address from...
ip=`head -n1 file.dat` # read ip address from file
end=${ip##*\.} # delete everthing before last dot (leaving 234/235)

while (( end++ < 254 )); do # while the 234/235 is less than 254...
Showing results 1 to 13 of 13

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