Sponsored Content
Full Discussion: Generate hexadecimal
Top Forums Shell Programming and Scripting Generate hexadecimal Post 303012088 by nimafire on Monday 29th of January 2018 04:31:09 PM
Old 01-29-2018
Generate hexadecimal

Hello
I'm working on a script to list all ipv6 from given address
so I've run this script which create hex part of ipv6

Code:
STR2=159
END2=200
SUM2=`expr $END2 - $STR2`
for ((i=STR2;i<=END2;++i)); do
x=$( printf "%x" $i ) ; echo $x
echo -e "::"$x >> netpart.txt
done

output is :

Code:
::9f
::a0
::a1
::a2
::a3
::a4
::a5
etc.

there are a billion ip between 0000:0000:0000:0000 AND ffff:ffff:ffff:ffff like:
Code:
0000:0000:0000:0000
0000:0000:0000:0095
0000:0000:0000:0096

How can I list all of them?

---------- Post updated at 04:31 PM ---------- Previous update was at 04:07 PM ----------

mm let me explain more clear
0000:0000:0000:0095 has 4 part and each part max number is 9999 so the last number will be 9999:9999:9999:9999

How can I read number from user like 100000 and then calculate and echo all number after 0000:0000:0000:0095

Something like:
Code:
0000:0000:0000:0095
0000:0000:0000:0096
....
0000:0000:0000:9999
0000:0000:0001:0000
0000:0000:0001:0001
0000:0000:0001:0002
....
etc


Last edited by rbatte1; 01-30-2018 at 05:01 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get Hexadecimal Value

I have a record in a file that ends with the new line character "\n". How dio I determine the hexadecimal value for that? (2 Replies)
Discussion started by: lesstjm
2 Replies

2. UNIX for Dummies Questions & Answers

looping in hexadecimal with bash

hello every one this is my first post ... well i'm new to linux .... i've been enjoying shell scripting tutorials and i'm new to writting scripts i want to write a script that creates a directory tree named in hexadecimal but i'm stuck at the hexadecimal part ... here is my code (incase i... (2 Replies)
Discussion started by: soba
2 Replies

3. UNIX for Dummies Questions & Answers

Hexadecimal to Decimal

Hi all, I have a small script to convert my HexaDecimal Input to Decimal as output. #!/bin/ksh hd=00208060 dec=`printf %d $hd` echo $dec Output of the above program: printf: 00208060 not completely converted 16 But my expected output is "2130016". How can i acheive this. I... (2 Replies)
Discussion started by: Arunprasad
2 Replies

4. Programming

Hexadecimal to ascii

Let's suppose i have a hexadecimal array with 16 cells.for example b3e2d5f636111780 i want to convert it to an array of ascii characters(in C) so that i can reduce total size of the file i want to put it in. But i am afraid i have not fully understand the difference between ascii and hex(i... (3 Replies)
Discussion started by: bashuser2
3 Replies

5. Shell Programming and Scripting

hexadecimal replacing with awk ?

Hi there ! I have text files with some nonsense characters in it, so different text editors put different nonsense symbols, and, worse, the application that should be able to read these files doesn't. With xxd, the nonsense characters show as "efbfbd", while they should be "c2a7" (the... (2 Replies)
Discussion started by: jossojjos
2 Replies

6. Shell Programming and Scripting

Convert hexadecimal value in decimal value

hi all, this is my script: #! /bin/sh minutes=$( { i2cget -f -y 0 0x51 3; } 2>&1 ) minutes=${minutes:2} hour=$( { i2cget -f -y 0 0x51 4; } 2>&1 ) hour=${hour:2} day=$( { i2cget -f -y 0 0x51 5; } 2>&1 ) day=${day:2} month=$( { i2cget -f -y 0 0x51 7; } 2>&1 ) month=${month:2} ... (6 Replies)
Discussion started by: enaud
6 Replies

7. Shell Programming and Scripting

Hexadecimal to Binary conversion

Hi Guys, Is it possible to convert the hexadecimal to Binary by unix command.....I could not figure out.... If I need to convert AF6D to binary...what could be the way to do? Thanks in advance!! ---------- Post updated at 02:57 AM ---------- Previous update was at 02:42 AM ---------- I... (6 Replies)
Discussion started by: Indra2011
6 Replies

8. Shell Programming and Scripting

Conversion from Hexadecimal to binary

How can I convert hexadecimal values to Binary from the second field to the end Input: WS-2 23 345 235 DT-3 45 4A3 000 pp-2 76 300 E4 Output: WS-2 100011 1101000101 1000110101 DT-3 1000101 10010100011 000 pp-2 1110110 1100000000 11100100 (16 Replies)
Discussion started by: aydj
16 Replies

9. Programming

Hexadecimal to binary operation

Dear all, I am trying to write c-program to read the following file containing hexadecimal values (snippet of big data file). I want to combine two hexadecimal values together like A0A03E01 and then would like to have the binary equivalent to perform further test on it. Unfortunately, it failed... (16 Replies)
Discussion started by: emily
16 Replies

10. UNIX for Dummies Questions & Answers

Convert hexadecimal value to decimal value

Hi All, cat filename | awk '{print $1, $2, $4, $5, $6, $7, $8, $9, $10;}' | awk 'NF > 0' OUTPUT: 2015-01-19 00:12:32 00000000fbfa0000 000000009ae5cf80 014d 015d 0017 003c 0362de20 2015-01-19 00:13:52 00000000fc820000 00000000994c6758 014c 015d 000b 003c 08670250 2015-01-19 00:14:25... (12 Replies)
Discussion started by: sam@sam
12 Replies
IFSYSCTL(5)						       Network configuration						       IFSYSCTL(5)

NAME
ifsysctl[-<interface name>] - per network interface sysctl settings SYNOPSIS
/etc/sysconfig/network/ifsysctl /etc/sysconfig/network/ifsysctl-<interface name> DESCRIPTION
These files are intended to contain sysctl settings, that should be applied when a network interface is created. This are usually interface specific settings, like: net.ipv6.conf.eth0.use_tempaddr = 1 or net.ipv4.conf.eth0.rp_filter = 0 The settings are applied by the /etc/sysconfig/network/scripts/ifup-sysctl script executed via /etc/udev/rules.d/77-network.rules rule (see udev(7)), after the creation and after the rename of the interface name to its persistent name (when applicable), but before the ifup <interface name> -o hotplug may be executed to configure the interface. The settings are not applied by default when the NetworkManager is active (NETWORKMANAGER=yes), except when the IFSYSCTL_NETWORKMANAGER=yes variable is set in the /etc/sysconfig/network/config file. Settings from the ifsysctl- file are applied every time an interface has been created. Settings from the ifsysctl-interface name file are applied when the interface with the corresponding interface name has been created. SYNTAX
The sysctl(8) utility is required to apply the settings. It supports two separator characters for sysctl keywords: a "." in default format and a "/" in the alternate format. Therefore the syntax is basically same to the /etc/sysctl.conf file. Interface names may contain a ".". In the default sysctl format using a "." as separator, that is any "." in the interface name of the key- word, has to be replaced with a "/". In the alternate sysctl format with "/" as separator, normal interface names can be used. Optionally, the ifsysctl files may contain also the $INTERFACE and the $SYSCTL_IF variables, that are automatically replaced with the cur- rent interface name usable in the alternate format and with the sysctl-quoted interface name for the default format, before the settings are passed to the sysctl utility. Note also, that settings with variables in the ifsysctl (without the -<interface name> suffix), will be applied for every interface! Further, files with variables are not compatible to the /etc/sysctl.conf file. EXAMPLES
Settings for "eth0" and "eth0.1" interfaces # using "." as separator: net.ipv6.conf.eth0.use_tempaddr = 1 net.ipv6.conf.eth0/1.use_tempaddr = 1 # using "/" as separator: net/ipv6/conf/eth0/use_tempaddr = 1 net/ipv6/conf/eth0.0/use_tempaddr = 1 Settings with variables: # using "." as separator: net.ipv6.conf.$SYSCTL_IF.use_tempaddr = 1 # using "/" as separator: net/ipv6/conf/$INTERFACE/use_tempaddr = 1 To test your ifsysctl-eth0 or ifsysctl file, use: /etc/sysconfig/network/scripts/ifup-sysctl eth0 -o debug BUGS
Please report bugs at <https://bugzilla.novell.com/> AUTHOR
Marius Tomaschewski <mt@suse.de> SEE ALSO
ifup(8) ifcfg(5) sysctl(8) sysconfig December 2009 IFSYSCTL(5)
All times are GMT -4. The time now is 09:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy