What do values mean in inode column (proc/net/tcp(6))? - tcp

This is a piece of /proc/net/tcp file:
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
6: 1904A8C0:AC35 9603020A:1ED0 01 00000000:00000000 00:00000000 00000000 10055 0 8506 2 c1624900 129 0 0 10 -1
7: 1904A8C0:E8C4 13A11C1F:0050 06 00000000:00000000 03:00001390
00000000 0 0 0 3 d6267780
Can anyone explain me what do values mean in the inode column? I`m intrested in two cases.
8506 2 c1624900 129 0 0 10 -1
0 3 d6267780
I only know first value is inode number (unique file number).

linux-2.6.35.6/net/ipv4/tcp_ipv4.c
2358 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
2359 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
2360 i, src, srcp, dest, destp, sk->sk_state,
2361 tp->write_seq - tp->snd_una,
2362 rx_queue,
2363 timer_active,
2364 jiffies_to_clock_t(timer_expires - jiffies),
2365 icsk->icsk_retransmits,
2366 sock_i_uid(sk),
2367 icsk->icsk_probes_out,
2368 sock_i_ino(sk),
2369 atomic_read(&sk->sk_refcnt), sk,
2370 jiffies_to_clock_t(icsk->icsk_rto),
2371 jiffies_to_clock_t(icsk->icsk_ack.ato),
2372 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
2373 tp->snd_cwnd,
2374 tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh,
2375 len);

Related

Slow query in MariaDB-10.5.15, fetching time, with a simple select

I'm having a problem with a slow query in MariaDB, which is driving me crazy, and it's X-file worthy.
I have a simple table, which I show you below, with only 10 rows, and the time it takes to return a simple select * from the table is more than 180 seconds !!!!
I provide the following data to see if you see something strange and you can help me:
a) The structure of the table, to highlight the mediumblog field where an image is saved.
b) mysql slow_query output.
c) Global variables.
a) Table structure
CREATE TABLE `clientespendientes` (
`numeroid` varchar(40) NOT NULL DEFAULT '' COMMENT 'Número de DNI o pasaporte del cliente',
`direccionpublica` blob NOT NULL COMMENT 'Dirección pública del cliente',
`email` varchar(101) NOT NULL DEFAULT '' COMMENT 'Email del usuario',
`documento` mediumblob NOT NULL COMMENT 'DNI o Pasaporte del Cliente',
`fecha` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Momento en el que creó la petición de verificación',
`nacionalidad` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Nacionalidad Cliente',
`idioma` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Idioma de cara al envío de mails',
`ip` varchar(16) DEFAULT NULL COMMENT 'Ip desde la que se dio de alta el cliente',
`nombrefichero` varchar(30) DEFAULT '' COMMENT 'Nombre del fichero con el que debemos devolver la clave pública',
PRIMARY KEY (`numeroid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Clientes pendientes de verificar'
b) mysql slow query output
Time: 220719 23:46:08
User#Host: cabe[cabe] # [217.61.225.227]
Thread_id: 33 Schema: litra QC_hit: No
**Query_time: 179.691794** Lock_time: 0.000120 Rows_sent: 10 Rows_examined: 10
Rows_affected: 0 Bytes_sent: 5504314
Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
Filesort: No Filesort_on_disk: No Merge_passes: 0 Priority_queue: No
explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
explain: 1 SIMPLE clientespendientes ALL NULL NULL NULL NULL 10 10.00 100.00 100.00
SET timestamp=1658274368;
SELECT * FROM litra.clientespendientes
LIMIT 0, 1000;
c) Global variables.
analyze_sample_percentage 100.000000
aria_block_size 8192
aria_checkpoint_interval 30
aria_checkpoint_log_activity 1048576
aria_encrypt_tables OFF
aria_force_start_after_recovery_failures 0
aria_group_commit none
aria_group_commit_interval 0
aria_log_file_size 1073741824
aria_log_purge_type immediate
aria_max_sort_file_size 9223372036853727232
aria_page_checksum ON
aria_pagecache_age_threshold 300
aria_pagecache_buffer_size 134217728
aria_pagecache_division_limit 100
aria_pagecache_file_hash_size 512
aria_recover_options BACKUP,QUICK
aria_repair_threads 1
aria_sort_buffer_size 268434432
aria_stats_method nulls_unequal
aria_sync_log_dir NEWFILE
aria_used_for_temp_tables ON
auto_increment_increment 1
auto_increment_offset 1
autocommit ON
automatic_sp_privileges ON
back_log 80
basedir /usr
big_tables OFF
bind_address 0.0.0.0
binlog_annotate_row_events ON
binlog_cache_size 32768
binlog_checksum CRC32
binlog_commit_wait_count 0
binlog_commit_wait_usec 100000
binlog_direct_non_transactional_updates OFF
binlog_file_cache_size 16384
binlog_format MIXED
binlog_optimize_thread_scheduling ON
binlog_row_image FULL
binlog_row_metadata NO_LOG
binlog_stmt_cache_size 32768
bulk_insert_buffer_size 8388608
character_set_client utf8
character_set_connection utf8
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8
character_set_server utf8mb4
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/
check_constraint_checks ON
collation_connection utf8_general_ci
collation_database utf8mb4_general_ci
collation_server utf8mb4_general_ci
column_compression_threshold 100
column_compression_zlib_level 6
column_compression_zlib_strategy DEFAULT_STRATEGY
column_compression_zlib_wrap OFF
completion_type NO_CHAIN
concurrent_insert AUTO
connect_timeout 10
core_file OFF
datadir /var/lib/mysql/
date_format %Y-%m-%d
datetime_format %Y-%m-%d %H:%i:%s
deadlock_search_depth_long 15
deadlock_search_depth_short 4
deadlock_timeout_long 50000000
deadlock_timeout_short 10000
debug_no_thread_alarm OFF
default_master_connection
default_password_lifetime 0
default_regex_flags
default_storage_engine InnoDB
default_tmp_storage_engine
default_week_format 0
delay_key_write ON
delayed_insert_limit 100
delayed_insert_timeout 300
delayed_queue_size 1000
disconnect_on_expired_password OFF
div_precision_increment 4
encrypt_binlog OFF
encrypt_tmp_disk_tables OFF
encrypt_tmp_files OFF
enforce_storage_engine
eq_range_index_dive_limit 200
error_count 0
event_scheduler OFF
expensive_subquery_limit 100
expire_logs_days 10
explicit_defaults_for_timestamp OFF
external_user
extra_max_connections 1
extra_port 0
flush OFF
flush_time 0
foreign_key_checks ON
ft_boolean_syntax + -><()~*:""&|
ft_max_word_len 84
ft_min_word_len 4
ft_query_expansion_limit 20
ft_stopword_file (built-in)
general_log ON
general_log_file /var/log/mysql/mysql.log
group_concat_max_len 1048576
gtid_binlog_pos
gtid_binlog_state
gtid_cleanup_batch_size 64
gtid_current_pos
gtid_domain_id 0
gtid_ignore_duplicates OFF
gtid_pos_auto_engines
gtid_seq_no 0
gtid_slave_pos
gtid_strict_mode OFF
have_compress YES
have_crypt YES
have_dynamic_loading YES
have_geometry YES
have_openssl YES
have_profiling YES
have_query_cache YES
have_rtree_keys YES
have_ssl DISABLED
have_symlink YES
histogram_size 254
histogram_type DOUBLE_PREC_HB
host_cache_size 279
hostname Litra0
identity 0
idle_readonly_transaction_timeout 0
idle_transaction_timeout 0
idle_write_transaction_timeout 0
ignore_builtin_innodb OFF
ignore_db_dirs
in_predicate_conversion_threshold 1000
in_transaction 0
init_connect
init_file
init_slave
innodb_adaptive_flushing ON
innodb_adaptive_flushing_lwm 10.000000
innodb_adaptive_hash_index OFF
innodb_adaptive_hash_index_parts 8
innodb_adaptive_max_sleep_delay 0
innodb_autoextend_increment 64
innodb_autoinc_lock_mode 1
innodb_background_scrub_data_check_interval 0
innodb_background_scrub_data_compressed OFF
innodb_background_scrub_data_interval 0
innodb_background_scrub_data_uncompressed OFF
innodb_buf_dump_status_frequency 0
innodb_buffer_pool_chunk_size 134217728
innodb_buffer_pool_dump_at_shutdown ON
innodb_buffer_pool_dump_now OFF
innodb_buffer_pool_dump_pct 25
innodb_buffer_pool_filename ib_buffer_pool
innodb_buffer_pool_instances 1
innodb_buffer_pool_load_abort OFF
innodb_buffer_pool_load_at_startup ON
innodb_buffer_pool_load_now OFF
innodb_buffer_pool_size 1073741824
innodb_change_buffer_max_size 25
innodb_change_buffering none
innodb_checksum_algorithm full_crc32
innodb_cmp_per_index_enabled OFF
innodb_commit_concurrency 0
innodb_compression_algorithm zlib
innodb_compression_default OFF
innodb_compression_failure_threshold_pct 5
innodb_compression_level 6
innodb_compression_pad_pct_max 50
innodb_concurrency_tickets 0
innodb_data_file_path ibdata1:12M:autoextend
innodb_data_home_dir
innodb_deadlock_detect ON
innodb_default_encryption_key_id 1
innodb_default_row_format dynamic
innodb_defragment OFF
innodb_defragment_fill_factor 0.900000
innodb_defragment_fill_factor_n_recs 20
innodb_defragment_frequency 40
innodb_defragment_n_pages 7
innodb_defragment_stats_accuracy 0
innodb_disable_sort_file_cache OFF
innodb_disallow_writes OFF
innodb_doublewrite ON
innodb_encrypt_log OFF
innodb_encrypt_tables OFF
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 1
innodb_encryption_rotation_iops 100
innodb_encryption_threads 0
innodb_fast_shutdown 1
innodb_fatal_semaphore_wait_threshold 600
innodb_file_format
innodb_file_per_table ON
innodb_fill_factor 100
innodb_flush_log_at_timeout 1
innodb_flush_log_at_trx_commit 1
innodb_flush_method fsync
innodb_flush_neighbors 1
innodb_flush_sync ON
innodb_flushing_avg_loops 30
innodb_force_load_corrupted OFF
innodb_force_primary_key OFF
innodb_force_recovery 0
innodb_ft_aux_table
innodb_ft_cache_size 8000000
innodb_ft_enable_diag_print OFF
innodb_ft_enable_stopword ON
innodb_ft_max_token_size 84
innodb_ft_min_token_size 3
innodb_ft_num_word_optimize 2000
innodb_ft_result_cache_limit 2000000000
innodb_ft_server_stopword_table
innodb_ft_sort_pll_degree 2
innodb_ft_total_cache_size 640000000
innodb_ft_user_stopword_table
innodb_immediate_scrub_data_uncompressed OFF
innodb_instant_alter_column_allowed add_drop_reorder
innodb_io_capacity 200
innodb_io_capacity_max 2000
innodb_large_prefix
innodb_lock_schedule_algorithm fcfs
innodb_lock_wait_timeout 50
innodb_lock_wait_timeout 50
innodb_log_buffer_size 16777216
innodb_log_checksums ON
innodb_log_compressed_pages ON
innodb_log_file_size 100663296
innodb_log_files_in_group 1
innodb_log_group_home_dir ./
innodb_log_optimize_ddl OFF
innodb_log_write_ahead_size 8192
innodb_lru_flush_size 32
innodb_lru_scan_depth 1536
innodb_max_dirty_pages_pct 90.000000
innodb_max_dirty_pages_pct_lwm 0.000000
innodb_max_purge_lag 0
innodb_max_purge_lag_delay 0
innodb_max_purge_lag_wait 4294967295
innodb_max_undo_log_size 10485760
innodb_monitor_disable
innodb_monitor_enable
innodb_monitor_reset
innodb_monitor_reset_all
innodb_old_blocks_pct 37
innodb_old_blocks_time 1000
innodb_online_alter_log_max_size 134217728
innodb_open_files 2000
innodb_optimize_fulltext_only OFF
innodb_page_cleaners 1
innodb_page_size 16384
innodb_prefix_index_cluster_optimization OFF
innodb_print_all_deadlocks OFF
innodb_purge_batch_size 300
innodb_purge_rseg_truncate_frequency 128
innodb_purge_threads 4
innodb_random_read_ahead OFF
innodb_read_ahead_threshold 56
innodb_read_io_threads 4
innodb_read_only OFF
innodb_replication_delay 0
innodb_rollback_on_timeout OFF
innodb_scrub_log OFF
innodb_scrub_log_speed 256
innodb_sort_buffer_size 1048576
innodb_spin_wait_delay 4
innodb_stats_auto_recalc ON
innodb_stats_include_delete_marked OFF
innodb_stats_method nulls_equal
innodb_stats_modified_counter 0
innodb_stats_on_metadata OFF
innodb_stats_persistent ON
innodb_stats_persistent_sample_pages 20
innodb_stats_traditional ON
innodb_stats_transient_sample_pages 8
innodb_status_output OFF
innodb_status_output_locks OFF
innodb_strict_mode ON
innodb_sync_array_size 1
innodb_sync_spin_loops 30
innodb_table_locks ON
innodb_temp_data_file_path ibtmp1:12M:autoextend
innodb_thread_concurrency 0
innodb_thread_sleep_delay 0
innodb_tmpdir
innodb_undo_directory ./
innodb_undo_log_truncate OFF
innodb_undo_logs 128
innodb_undo_tablespaces 0
innodb_use_atomic_writes ON
innodb_use_native_aio ON
innodb_version 10.5.15
innodb_write_io_threads 4
insert_id 0
interactive_timeout 28800
join_buffer_size 262144
join_buffer_space_limit 2097152
join_cache_level 2
keep_files_on_create OFF
key_buffer_size 268435456
key_cache_age_threshold 300
key_cache_block_size 1024
key_cache_division_limit 100
key_cache_file_hash_size 512
key_cache_segments 0
large_files_support ON
large_page_size 0
large_pages OFF
last_gtid
last_insert_id 0
lc_messages en_US
lc_messages_dir /usr/share/mysql
lc_time_names en_US
license GPL
local_infile ON
lock_wait_timeout 86400
locked_in_memory OFF
log_bin OFF
log_bin_basename
log_bin_compress OFF
log_bin_compress_min_len 256
log_bin_index
log_bin_trust_function_creators OFF
log_disabled_statements sp
log_error /var/log/mysql/error.log
log_output FILE
log_queries_not_using_indexes OFF
log_slave_updates OFF
log_slow_admin_statements ON
log_slow_disabled_statements sp
log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
log_slow_rate_limit 1
log_slow_slave_statements ON
log_slow_verbosity query_plan,explain
log_tc_size 24576
log_warnings 2
long_query_time 10.000000
low_priority_updates OFF
lower_case_file_system OFF
lower_case_table_names 0
master_verify_checksum OFF
max_allowed_packet 1073741824
max_binlog_cache_size 18446744073709547520
max_binlog_size 1073741824
max_binlog_stmt_cache_size 18446744073709547520
max_connect_errors 100
max_connections 151
max_delayed_threads 20
max_digest_length 1024
max_error_count 64
max_heap_table_size 16777216
max_insert_delayed_threads 20
max_join_size 18446744073709551615
max_length_for_sort_data 1024
max_password_errors 4294967295
max_prepared_stmt_count 16382
max_recursive_iterations 4294967295
max_relay_log_size 1073741824
max_rowid_filter_size 131072
max_seeks_for_key 4294967295
max_session_mem_used 9223372036854775807
max_rowid_filter_size 131072
max_seeks_for_key 4294967295
max_session_mem_used 9223372036854775807
max_sort_length 1024
max_sp_recursion_depth 0
max_statement_time 0.000000
max_tmp_tables 32
max_user_connections 0
max_write_lock_count 4294967295
metadata_locks_cache_size 1024
metadata_locks_hash_instances 8
min_examined_row_limit 0
mrr_buffer_size 262144
myisam_block_size 1024
myisam_data_pointer_size 6
myisam_max_sort_file_size 9223372036853727232
myisam_mmap_size 18446744073709551615
myisam_recover_options BACKUP,QUICK
myisam_repair_threads 1
myisam_sort_buffer_size 134216704
myisam_stats_method NULLS_UNEQUAL
myisam_use_mmap OFF
mysql56_temporal_format ON
net_buffer_length 16384
net_read_timeout 30
net_retry_count 10
net_write_timeout 60
old OFF
old_alter_table DEFAULT
old_mode
old_passwords OFF
open_files_limit 32194
optimizer_max_sel_arg_weight 32000
optimizer_prune_level 1
optimizer_search_depth 62
optimizer_selectivity_sampling_limit 100
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_cond>
optimizer_trace enabled=off
optimizer_trace_max_mem_size 1048576
optimizer_use_condition_selectivity 4
performance_schema OFF
performance_schema_accounts_size -1
performance_schema_digests_size -1
performance_schema_events_stages_history_long_size -1
performance_schema_events_stages_history_size -1
performance_schema_events_statements_history_long_size -1
performance_schema_events_statements_history_long_size -1
performance_schema_events_statements_history_size -1
performance_schema_events_transactions_history_long_size -1
performance_schema_events_transactions_history_size -1
performance_schema_events_waits_history_long_size -1
performance_schema_events_waits_history_size -1
performance_schema_hosts_size -1
performance_schema_max_cond_classes 90
performance_schema_max_cond_instances -1
performance_schema_max_digest_length 1024
performance_schema_max_file_classes 80
performance_schema_max_file_handles 32768
performance_schema_max_file_instances -1
performance_schema_max_index_stat -1
performance_schema_max_memory_classes 320
performance_schema_max_metadata_locks -1
performance_schema_max_mutex_classes 210
performance_schema_max_mutex_instances -1
performance_schema_max_prepared_statements_instances -1
performance_schema_max_program_instances -1
performance_schema_max_rwlock_classes 50
performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances -1
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
performance_schema_max_statement_classes 222
performance_schema_max_statement_stack 10
performance_schema_max_table_handles -1
performance_schema_max_table_instances -1
performance_schema_max_table_lock_stat -1
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances -1
performance_schema_session_connect_attrs_size -1
performance_schema_setup_actors_size -1
performance_schema_setup_objects_size -1
performance_schema_users_size -1
pid_file /run/mysqld/mysqld.pid
plugin_dir /usr/lib/mysql/plugin/
plugin_maturity gamma
port 3306
preload_buffer_size 32768
profiling OFF
profiling_history_size 15
progress_report_time 5
protocol_version 10
proxy_protocol_networks
proxy_user
pseudo_slave_mode OFF
pseudo_thread_id 37
query_alloc_block_size 16384
query_cache_limit 1048576
query_cache_min_res_unit 4096
query_cache_size 1048576
query_cache_strip_comments OFF
query_cache_type OFF
query_cache_wlock_invalidate OFF
query_prealloc_size 24576
rand_seed1 338934328
rand_seed2 991539275
range_alloc_block_size 4096
read_binlog_speed_limit 0
read_buffer_size 131072
read_only OFF
read_rnd_buffer_size 262144
relay_log
relay_log_basename
relay_log_index
relay_log_info_file relay-log.info
relay_log_purge ON
relay_log_recovery OFF
relay_log_space_limit 0
replicate_annotate_row_events ON
replicate_do_db
replicate_do_table
replicate_events_marked_for_skip REPLICATE
replicate_ignore_db
replicate_ignore_table
replicate_wild_do_table
replicate_wild_ignore_table
report_host
report_password
report_port 3306
report_user
require_secure_transport OFF
rowid_merge_buff_size 8388608
rpl_semi_sync_master_enabled OFF
rpl_semi_sync_master_timeout 10000
rpl_semi_sync_master_trace_level 32
rpl_semi_sync_master_wait_no_slave ON
rpl_semi_sync_master_wait_point AFTER_COMMIT
rpl_semi_sync_master_wait_point AFTER_COMMIT
rpl_semi_sync_slave_delay_master OFF
rpl_semi_sync_slave_enabled OFF
rpl_semi_sync_slave_kill_conn_timeout 5
rpl_semi_sync_slave_trace_level 32
secure_auth ON
secure_file_priv
secure_timestamp NO
server_id 1
session_track_schema ON
session_track_state_change OFF
session_track_system_variables autocommit,character_set_client,character_set_connection,character_set_results,time_zone
session_track_transaction_info OFF
skip_external_locking ON
skip_name_resolve OFF
skip_networking OFF
skip_parallel_replication OFF
skip_replication OFF
skip_show_database OFF
slave_compressed_protocol OFF
slave_ddl_exec_mode IDEMPOTENT
slave_domain_parallel_threads 0
slave_exec_mode STRICT
slave_load_tmpdir /tmp
slave_max_allowed_packet 1073741824
slave_net_timeout 60
slave_parallel_max_queued 131072
slave_parallel_mode optimistic
slave_parallel_threads 0
slave_parallel_workers 0
slave_run_triggers_for_rbr NO
slave_skip_errors OFF
slave_sql_verify_checksum ON
slave_transaction_retries 10
slave_transaction_retry_errors 1158,1159,1160,1161,1205,1213,1429,2013,12701
slave_transaction_retry_interval 0
slave_type_conversions
slow_launch_time 2
slow_query_log ON
slow_query_log_file /var/log/mysql/mariadb-slow.log
socket /run/mysqld/mysqld.sock
sort_buffer_size 2097152
sql_auto_is_null OFF
sql_big_selects ON
sql_buffer_result OFF
sql_if_exists OFF
sql_if_exists OFF
sql_log_bin ON
sql_log_off OFF
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_notes ON
sql_quote_show_create ON
sql_safe_updates OFF
sql_select_limit 18446744073709551615
sql_slave_skip_counter 0
sql_warnings OFF
ssl_ca
ssl_capath
ssl_cert
ssl_cipher
ssl_crl
ssl_crlpath
ssl_key
standard_compliant_cte ON
storage_engine InnoDB
stored_program_cache 256
strict_password_validation ON
sync_binlog 0
sync_frm ON
sync_master_info 10000
sync_relay_log 10000
sync_relay_log_info 10000
system_time_zone UTC
system_versioning_alter_history ERROR
system_versioning_asof DEFAULT
table_definition_cache 400
table_open_cache 2000
table_open_cache_instances 8
tcp_keepalive_interval 0
tcp_keepalive_probes 0
tcp_keepalive_time 0
tcp_nodelay ON
thread_cache_size 151
thread_handling one-thread-per-connection
thread_pool_dedicated_listener OFF
thread_pool_exact_stats OFF
thread_pool_idle_timeout 60
thread_pool_max_threads 65536
thread_pool_oversubscribe 3
thread_pool_prio_kickup_timer 1000
thread_pool_priority auto
thread_pool_prio_kickup_timer 1000
thread_pool_priority auto
thread_pool_size 12
thread_pool_stall_limit 500
thread_stack 196608
time_format %H:%i:%s
time_zone SYSTEM
timestamp 1658275075.187231
tls_version TLSv1.1,TLSv1.2,TLSv1.3
tmp_disk_table_size 18446744073709551615
tmp_memory_table_size 16777216
tmp_table_size 16777216
tmpdir /tmp
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
tx_isolation REPEATABLE-READ
tx_read_only OFF
unique_checks ON
updatable_views_with_limit YES
use_stat_tables PREFERABLY_FOR_QUERIES
userstat OFF
version 10.5.15-MariaDB-0+deb11u1-log
version_comment Debian 11
version_compile_machine x86_64
version_compile_os debian-linux-gnu
version_malloc_library system
version_source_revision 9aa3564e8a06c3d2027fc514213ecf42b049b06e
version_ssl_library OpenSSL 1.1.1n 15 Mar 2022
wait_timeout 28800
warning_count 0
wsrep_osu_method TOI
wsrep_sr_store table
wsrep_auto_increment_control ON
wsrep_causal_reads OFF
wsrep_certification_rules strict
wsrep_certify_nonpk ON
wsrep_cluster_address
wsrep_cluster_name my_wsrep_cluster
wsrep_convert_lock_to_trx OFF
wsrep_data_home_dir /var/lib/mysql/
wsrep_dbug_option
wsrep_debug NONE
wsrep_desync OFF
wsrep_dirty_reads OFF
wsrep_drupal_282555_workaround OFF
wsrep_forced_binlog_format NONE
wsrep_gtid_domain_id 0
wsrep_gtid_mode OFF
wsrep_gtid_seq_no 0
wsrep_ignore_apply_errors 7
wsrep_load_data_splitting OFF
wsrep_log_conflicts OFF
wsrep_max_ws_rows 0
wsrep_max_ws_size 2147483647
wsrep_mysql_replication_bundle 0
wsrep_node_address
wsrep_node_incoming_address AUTO
wsrep_node_name Litra0
wsrep_notify_cmd
wsrep_on OFF
wsrep_patch_version wsrep_26.22
wsrep_provider none
wsrep_provider_options
wsrep_recover OFF
wsrep_reject_queries NONE
wsrep_replicate_myisam OFF
wsrep_restart_slave OFF
wsrep_retry_autocommit 1
wsrep_slave_fk_checks ON
wsrep_slave_uk_checks OFF
wsrep_slave_threads 1
wsrep_sst_auth
wsrep_sst_donor
wsrep_sst_donor_rejects_queries OFF
wsrep_sst_method rsync
wsrep_sst_receive_address AUTO
wsrep_start_position 00000000-0000-0000-0000-000000000000:-1
wsrep_strict_ddl OFF
wsrep_sync_wait 0
wsrep_trx_fragment_size 0
wsrep_trx_fragment_unit bytes

Looping over two R dataframes to create a third dataframe

I am trying to backtest a trading strategy.
I am coding in R 3.6
The data is in two dataframes. The first is five years of daily price activity (i.e. fiveyrdaily). The second dataframe is price activity for the same five years only at the one minute level (i.e. fiveyrminutes). This data includes sessions low, high, open, and close.
My strategy is to loop over the respective days of the minute dataframe, while referring to and populating data on the daily dataframe to determine the following:
Condition that warrants the opening of a position (i.e. long or short).
Whether the target or stop price has been achieved.
Log the "trade" on a third dataframe (ORBOorders).
The embedded loops are not working the way I thought they would and I can't figure out why.
I know I can make the code simplier but it keeps getting drawn out so I can figure out where it is I'm going wrong.
I understand that appending to a vector in a loop is not the preferred way to handle vectors but I don't know how large the vector will be after the program is complete. I'd love to hear any ideas.
This is a strategy that seeks to catch price as it moves out of the range established in the first five minutes of the day.
This is the code to identify the direction of price movement after the initial 5 minutes. The counter is not working. The goal is to know the index of a specific event within the subsetted fiveyrminute dataframe (i.e. todaysdate); I will use this in the next batch of code below. The counter starts at 6 for the sixth minute. The output is never higher than 7, so, it's not counting with each iteration of the loop. I can't figure out why.
for (i in 1:length(fiveyrdaily$Date)){
todaysdate <- subset(fiveyrminutes, fiveyrdaily$Date[i] == fiveyrminutes$Date) # subset so I'm only seeing the respective days in the minutes dataframe
counter3 <- 6 # start a counter so I can track which position I'm in within the minutes dataframe, start after ORBO
for (t in counter:length(todaysdate$Date)){ #loop over the minutes dataframe
if ((fiveyrdaily$FiveHighClose[i] == 0) & (todaysdate$Close[t] > fiveyrdaily$FiveMinuteHigh[i])) {
fiveyrdaily$FiveHighClose[i] <- todaysdate$Close[t]
fiveyrdaily$FiveHighAfterClose[i] <- todaysdate$High[t] #record the session's high
counter3 <- counter3 + 1
fiveyrdaily$counterhigh[i] <- counter3 # record the position of this event within the subset of the minute dataframe
}
else if ((fiveyrdaily$FiveLowClose[i] == 0) & (todaysdate$Close[t] < fiveyrdaily$FiveMinuteLow[i])) {
fiveyrdaily$FiveLowClose[i] <- todaysdate$Close[t]
fiveyrdaily$FiveLowAfterClose[i] <- todaysdate$Low[t] # record the session's low
counter3 <- counter3 + 1
fiveyrdaily$counterlow[i] <- counter3
}
counter3 <- counter + 1
}
}
This is the "for" loop to determine if to buy and record the outcome.
#Open a long position
for (i in 1:length(fiveyrdaily$Date)){
if ((fiveyrdaily$counterhigh[i] < fiveyrdaily$counterlow[i]) & openposition < 2) {
#entryprice is the price predetermined ticks above the high
entryprice <- fiveyrdaily$FiveHighAfterClose[i] + (openticksaway * tickvalue)
#create stoploss
stoplossprice <- entryprice - stoplossvalue
#uncover target closest to five minute high
if (possibletargets > fiveyrdaily$FiveHighAfterClose[i]){ fiveyrdaily$ORBOtarget[i] <- min(possibletargets)}
poscounter <- fiveyrdaily$counterhigh[i]
beginforloop <- todaysdate[poscounter]
for (c in beginforloop:length(todaysdate$Date)){ #see where to open position starting from the occurence of the high
if ((entryprice > todaysdate$Low[c]) & (entryprice < todaysdate$High[c]) & (openposition < 2)){ #determine if conditions warrant entry
openposition <- openposition + 1 # open a position
if (openposition > 0){ #trade management
openpos <- 1
if ((stoplossprice < todaysdate$high[c]) & (stoplossprice > todaysdate$Low[c])){ # determine if stoploss has been hit
orderdate <- c(orderdate, todaysdate[c]) #enter data into orders dataframe
orderstrategy <- c(orderstrategy, "ORBO")
ordertype <- c(ordertype, "Long")
ordersymbol <- c(ordersymbol, "ES")
orderentry <- c(orderentry, entryprice)
orderclose <- c(orderclose, stoplossprice)
orderprofit <- c(orderprofit, abs((entryprice - stoplossprice) * pointvalue))
openpos <- 0
}
else if ((fiveyrdaily$ORBOtarget[i] < todaysdate$high[c]) & (fiveyrdaily$ORBOtarget[i] > todaysdate$Low[c])){ # determine if target has been hit
orderdate <- c(orderdate, todaysdate[c]) #enter data into orders dataframe
orderstrategy <- c(orderstrategy, "ORBO")
ordertype <- c(ordertype, "Long")
ordersymbol <- c(ordersymbol, "ES")
orderentry <- c(orderentry, entryprice)
orderclose <- c(orderclose, stoplossprice)
orderprofit <- c(orderprofit, abs((fiveyrdaily$ORBOtarget[i] - entryprice) * pointvalue))
openpos <- 0
}
}
}
}
}
}
Here is the data that is in the daily dataframe - fiveyrdaily:
> tail(fiveyrdaily)
Date Time Open High Low Close Vol OI UpperBand
1254 06/12/2019 16:15 2883.50 2889.75 2875.25 2881.00 1205406 2495060 2919.12
1255 06/13/2019 16:15 2894.75 2900.50 2886.75 2898.50 523312 448119 2925.39
1256 06/14/2019 16:15 2893.00 2899.75 2884.25 2894.75 1318938 951568 2927.99
1257 06/17/2019 16:15 2895.50 2902.75 2892.00 2896.25 1649621 1595842 2932.71
1258 06/18/2019 16:15 2914.00 2936.50 2910.25 2926.25 2257843 2093571 2944.19
1259 06/19/2019 16:15 2925.50 2936.75 2915.25 2933.50 1639495 2093571 2954.61
LowerBand MidLine PP RSI OverBot OverSld SlowK SlowD OverBot.1
1254 2751.13 2835.13 2892.58 56.24 70 30 86.82 87.54 80
1255 2749.21 2837.30 2882.00 59.06 70 30 87.60 88.11 80
1256 2748.24 2838.11 2895.25 58.19 70 30 89.01 87.81 80
1257 2746.94 2839.82 2892.92 58.46 70 30 91.79 89.47 80
1258 2743.68 2843.94 2897.00 63.41 70 30 92.63 91.14 80
1259 2740.02 2847.31 2924.33 64.51 70 30 95.20 93.21 80
OverSld.1 Volume Momentum ZeroLine InOrOut GapUpOrDown TypeOfDay PPTrend
1254 20 1205406 49.25 0 Disregard Disregard Bear Uptrend
1255 20 523312 93.50 0 Disregard Gap Up Bull Uptrend
1256 20 1318938 114.75 0 Disregard Disregard Bull Uptrend
1257 20 1649621 105.75 0 Disregard Disregard Bull Uptrend
1258 20 2257843 173.75 0 Disregard Gap Up Bull Uptrend
1259 20 1639495 184.00 0 Disregard Disregard Bull Uptrend
FiveMinuteLow FiveMinuteHigh FiveMinHtoL DollarFiveHtoL FiveHighClose
1254 2881.25 2889.75 8.50 425.0 0.00
1255 2892.00 2895.75 3.75 187.5 2896.00
1256 2886.25 2893.75 7.50 375.0 2894.75
1257 2892.00 2897.00 5.00 250.0 2897.25
1258 2910.25 2915.50 5.25 262.5 2920.75
1259 2923.25 2927.25 4.00 200.0 2930.00
FiveHighAfterClose FiveLowClose FiveLowAfterClose ORBOtarget counterhigh
1254 0.00 2881.00 2880.75 0 0
1255 2896.00 2891.75 2891.00 0 6
1256 2894.75 2886.00 2885.00 0 7
1257 2897.50 0.00 0.00 0 7
1258 2921.75 0.00 0.00 0 7
1259 2931.50 2922.50 2922.25 0 7
counterlow DollarOpentoHigh DollarOpentoClose DollarOpentoLow
1254 7 312.5 125.0 412.5
1255 7 287.5 187.5 400.0
1256 7 337.5 87.5 437.5
1257 0 362.5 37.5 175.0
1258 0 1125.0 612.5 187.5
1259 7 562.5 400.0 512.5
This is the data that is in the minutes dataframe - fiveyrminutes:
Date Time Open High Low Close Up Down UpperBand
509796 06/19/2019 16:10 2932.25 2932.50 2932.25 2932.50 717 430 2935.66
509797 06/19/2019 16:11 2932.25 2932.50 2932.25 2932.25 125 276 2935.46
509798 06/19/2019 16:12 2932.25 2932.75 2932.25 2932.75 612 604 2934.95
509799 06/19/2019 16:13 2932.50 2933.25 2932.50 2933.00 830 153 2934.66
509800 06/19/2019 16:14 2933.25 2933.25 2932.75 2933.00 676 376 2934.26
509801 06/19/2019 16:15 2932.75 2934.00 2932.75 2933.25 2929 2026 2933.90
LowerBand MidLine PP RSI OverBot OverSld SlowK SlowD OverBot.1
509796 2930.27 2932.96 2932.42 47.94 70 30 45.45 40.66 80
509797 2930.24 2932.85 2932.42 46.22 70 30 53.70 46.21 80
509798 2930.45 2932.70 2932.33 50.07 70 30 63.83 54.33 80
509799 2930.56 2932.61 2932.58 51.92 70 30 72.73 63.42 80
509800 2930.76 2932.51 2932.92 51.92 70 30 83.33 73.30 80
509801 2930.97 2932.44 2933.00 53.90 70 30 85.00 80.35 80
OverSld.1 Volume Momentum ZeroLine
509796 20 1147 -0.50 0
509797 20 401 -1.00 0
509798 20 1216 1.75 0
509799 20 983 1.75 0
509800 20 1052 2.00 0
509801 20 4955 1.75 0
This is the output for the orders dataframe, notice how it's empty - ORBOorders:
ORBOorders
orderdate orderstrategy ordertype ordersymbol orderentry orderclose
1 0 0
orderprofit
1 0
These are the problems:
-counter3 isn't working (to find after which point I should buy)
-The second batch of code gives this error:
Error in beginforloop:length(todaysdate$Date) : argument of length 0
In addition: Warning message: In if (possibletargets >
fiveyrdaily$FiveHighAfterClose[i]) { : the condition has length > 1
and only the first element will be used
-The ORBOorder dataframe has absolutely no data in it.
Thanks for any help in advance!

How do I make big.mark apply to more than just the first column?

Here's what I'm getting:
> panderOptions('big.mark', ',')
> foo <- rbind(cancer, cancer); for(i in 1:8) foo <- rbind(foo, foo)
> pander(table(foo$ph.karno, foo$pat.karno))
-----------------------------------------------------
30 40 50 60 70 80 90 100
--------- ----- ---- ---- ---- ---- ----- ----- -----
**50** 0 512 512 512 512 512 0 0
**60** 0 512 512 2560 4608 1536 0 0
**70** 1,024 0 1024 4608 3072 3072 1536 1536
**80** 0 0 0 6144 6656 6656 10240 4608
**90** 0 0 0 1536 5120 10752 12288 7680
**100** 0 0 0 0 512 3584 6656 4096
-----------------------------------------------------
I would like the comma delimiter to show up in the other columns too. How do I do that?
Best result I got (with t being your table call result):
> pander(format(t,big.mark=','))
----------------------------------------------------------
30 40 50 60 70 80 90 100
--------- ----- ---- ----- ----- ----- ------ ------ -----
**50** 0 512 512 512 512 512 0 0
**60** 0 512 512 2,560 4,608 1,536 0 0
**70** 1,024 0 1,024 4,608 3,072 3,072 1,536 1,536
**80** 0 0 0 6,144 6,656 6,656 10,240 4,608
**90** 0 0 0 1,536 5,120 10,752 12,288 7,680
**100** 0 0 0 0 512 3,584 6,656 4,096
----------------------------------------------------------
I assume this is a bug in pander.table.return but I did not dig enough to get the root cause.
Edit: I found the reason, line 283 of the function there's a for loop calling sapply on each col, but once the first column has been processed, the full array of the table is converted to char as we bring in chars from the output of format.
Then the subsequent calls to format can't format the number as they've been coerced to char.
Code from pander.table.return giving this behavior:
for (j in 1:ncol(t)) {
temp.t[, j] <- sapply(temp.t[, j], format, trim = TRUE,
digits = digits[j], decimal.mark = decimal.mark,
big.mark = big.mark)
}

UNIX Full Outer Join creates duplicate entries items despite correct order? Could it be the unpaired items creating disorder?

I have two files that I want to join based on their first column.
They are sorted, and not all of the values in the first column in FILE1 are in FILE2, and viceversa.
FILE1.TXT looks something like this, except it is around 15k lines:
snRNA:7SK 1037
snRNA:U11 144
snRNA:U1:21D 348.293
snRNA:U12:73B 16
snRNA:U1:82Eb 2.14286
snRNA:U1:95Ca 348.293
snRNA:U1:95Cb 351.96
snRNA:U1:95Cc 35.5095
snRNA:U2:14B 447.35
snRNA:U2:34ABa 459.75
snRNA:U2:34ABb 513.25
snRNA:U2:34ABc 509
snRNA:U2:38ABa 443.65
snRNA:U4:38AB 155
snRNA:U4:39B 611.833
snRNA:U4atac:82E 152.5
snRNA:U5:14B 1
snRNA:U5:23D 2.5
snRNA:U5:34A 11
snRNA:U5:38ABb 2.5
snRNA:U5:63BC 44
snRNA:U6:96Aa 18
snRNA:U6:96Ab 9.5
snRNA:U6:96Ac 8.5
snRNA:U7 4
snRNA:U8 8
FILE2.TXT looks like this, it is also ~15K lines:
snRNA:7SK 1259
snRNA:U11 33
snRNA:U1:21D 1480.57
snRNA:U12:73B 4
snRNA:U1:82Eb 10.2
snRNA:U1:95Ca 1480.57
snRNA:U1:95Cb 1484.03
snRNA:U1:95Cc 114.633
snRNA:U2:14B 4678.89
snRNA:U2:34ABa 4789.93
snRNA:U2:34ABb 5292.22
snRNA:U2:34ABc 5273.23
snRNA:U2:38ABa 4557.88
snRNA:U2:38ABb 3.75
snRNA:U4:38AB 405
snRNA:U4:39B 1503.5
snRNA:U4atac:82E 548
snRNA:U5:14B 25
snRNA:U5:23D 19
snRNA:U5:34A 32
snRNA:U5:38ABb 4
snRNA:U5:63BC 742
snRNA:U6:96Aa 39.5
snRNA:U6:96Ab 1
snRNA:U6:96Ac 1
snRNA:U7 11
As you can see, an element from FILE2 (snRNA:U5:38ABb) is missing IN FILE1, and an element from FILE1 is missing in FILE2. This is the case all through out the files, in both directions and multiple times.
I am writing the command as follows:
join -a1 -a2 -e "0" -1 1 -2 1 -o '0,1.2,2.2' -t ' '
FILE1.TXT FILE2.TXT
>JOIN_FILE.TXT
If I try the command with ONLY the 20 or so lines that I pasted from each file, it works as it should.
But when I run it on the entire files, The output is terrible, and I don't understand why. Both files were sorted using sort -k1,1, so even though some lines in 1 are not in 2, and viceversa, they are both in the same order.
What I get is duplicate entries for an item, such as: (again, I'm only showing a fraction of the output file...)
snRNA:7SK 0 1037
snRNA:U11 0 144
snRNA:U1:21D 0 348.293
snRNA:U12:73B 0 16
snRNA:U1:82Eb 0 2.14286
snRNA:U1:95Ca 0 348.293
snRNA:U1:95Cb 0 351.96
snRNA:U1:95Cc 0 35.5095
snRNA:U2:14B 0 447.35
snRNA:U2:34ABa 0 459.75
snRNA:U2:34ABb 0 513.25
snRNA:U2:34ABc 0 509
snRNA:U2:38ABa 0 443.65
snRNA:U4:38AB 0 155
snRNA:U4:39B 0 611.833
snRNA:U4atac:82E 0 152.5
snRNA:U5:14B 0 1
snRNA:U5:23D 0 2.5
snRNA:U5:34A 0 11
snRNA:U5:38ABb 0 2.5
snRNA:U5:63BC 0 44
snRNA:U6:96Aa 0 18
snRNA:U6:96Ab 0 9.5
snRNA:U6:96Ac 0 8.5
snRNA:U7 0 4
snRNA:7SK 1259 0
snRNA:U11 33 0
snRNA:U1:21D 1480.57 0
snRNA:U12:73B 4 0
snRNA:U1:82Eb 10.2 0
snRNA:U1:95Ca 1480.57 0
snRNA:U1:95Cb 1484.03 0
snRNA:U1:95Cc 114.633 0
snRNA:U2:14B 4678.89 0
snRNA:U2:34ABa 4789.93 0
snRNA:U2:34ABb 5292.22 0
snRNA:U2:34ABc 5273.23 0
snRNA:U2:38ABa 4557.88 0
snRNA:U2:38ABb 3.75 0
snRNA:U4:38AB 405 0
snRNA:U4:39B 1503.5 0
snRNA:U4atac:82E 548 0
snRNA:U5:14B 25 0
snRNA:U5:23D 19 0
snRNA:U5:34A 32 0
snRNA:U5:38ABb 4 0
snRNA:U5:63BC 742 0
snRNA:U6:96Aa 39.5 0
snRNA:U6:96Ab 1 0
snRNA:U6:96Ac 1 0
snRNA:U7 11 0
Where esentially everything has been duplicated, with one line for the value in FILE1 and another line for the value in FILE2. Could this be because of the accumulated differences between the files (i.e., all the non-paired entries before these specific ones?)
This scrambling of the output runs all throughout the file.
What am I doing wrong? Am I not specifying that entries in both files don't always match?
Is there any way to solve this?
Thanks a lot!
Carmen
Edit:
Here are the first 15 lines of each file, in order to show that the order is the same in both, but things start to get different because items in FILE1 start to appear that are not in FILE2, and viceversa. I wonder if this is what causes the mix-up.
==> FILE1 <==
128up 139
140up 170
14-3-3epsilon 4488
14-3-3zeta 24900
18w 885
26-29-p 517
2mit 3085.34
312 64
4EHP 9012.57
5.8SrRNA:CR40454 16.5
5-HT1A 1867
5-HT1B 366
5-HT2 2611.27
5-HT7 1641.67
5PtaseI 462
==> FILE2 <==
128up 80
140up 19
14-3-3epsilon 1718
14-3-3zeta 5554
18w 213
26-29-p 200
2mit 680.786
312 33
4EHP 1838.44
5-HT1A 303
5-HT1B 42
5-HT2 553.65
5-HT7 348.5
5PtaseI 105
5S_DM 46054.4
It is possible that you have "spaces" instead of "tabs" in one of your files.
Your join command seems to give duplicated entries when there is a space in one of the line:
#> bash fjoin.sh
:: join ::
join: s.file1s.txt:2: is not sorted: 128up 139
:: diff ::
1c1,3
< 128up 139 80
---
> 128up 0 80
> 128up 139 0 0
> 128up 139 0
#> grep " " file*txt
file1s.txt:128up 139
#> grep 128up file1s.txt
128up 139
128up 139
fjoin.sh
#!/bin/bash
f1="file1.txt"
f1s="file1s.txt"
f2="file2.txt"
# sort files & remove duplicate
sort -k 1b,1 ${f1} | uniq > s.${f1}
sort -k 1b,1 ${f1s} | uniq > s.${f1s}
sort -k 1b,1 ${f2} | uniq > s.${f2}
echo ":: join ::"
join -a1 -a2 -e "0" -1 1 -2 1 -o '0,1.2,2.2' -t ' ' s.${f1} s.${f2} > joined-1_f1_f2.txt
join -a1 -a2 -e "0" -1 1 -2 1 -o '0,1.2,2.2' -t ' ' s.${f1s} s.${f2} > joined-2_f1_f2.txt
echo " "
echo ":: diff ::"
diff joined-1_f1_f2.txt joined-2_f1_f2.txt
update
Setting LC_ALL=C as Pierre suggested could help.
There are less differences after adding export LC_ALL=C to fjoin.sh :
#> bash fjoin.sh
:: join ::
:: diff ::
1a2
> 128up 139 0 0

Converting unknown binary data into series of numbers? (with a known example)

I'm trying to find a way to convert files in a little-used archaic file format into something human readable...
As an example, od -x myfile gives:
0000000 2800 4620 1000 461e c800 461d a000 461e
0000020 8000 461e 2800 461e 5000 461f b800 461e
0000040 b800 461d 4000 461c a000 461e 3800 4620
0000060 f800 4621 7800 462a e000 4622 2800 463c
0000100 2000 464a 1000 4654 8c00 4693 5000 4661
0000120 7000 46ac 6c00 46d1 a400 4695 3c00 470a
0000140 b000 46ca 7400 46e9 c200 471b 9400 469e
0000160 9c00 4709 cc00 4719 4000 46b0 6400 46cc
...
which I know corresponds to these integers:
10250 10116 10098 10152 10144 10122 10196 10158
10094 10000 10152 10254 10366 10910 10424 12042
12936 13572 18886 14420 22072 ...
but I have no idea how to convert one to the other!!
Many many thanks to anyone who can help.
If possible, general tips for what to try/where to begin in this situation would also be appreciated.
Update: I put the full binary file online here http://pastebin.com/YL2ApExG and the numbers it corresponds to here http://pastebin.com/gXNntsaJ
In the hex dump, it seems to alternate between four digits, presumably they correspond to the numbers I want? separated either by 4600 or 4700. Unfortunately, I don't know where to go from here!
Someone else asked below: the binary file is a .dat file generated by an old spectroscopy program... it's 1336 bytes and corresponds to 334 integers, so it's four bytes per integer.
Well this is what you can do -
Step I: Do the od -x of the file and redirect it to a temp file (eg. hexdump.txt)
od -x myfile > hexdump.txt
Step II: You will now have a text file that contains hexadecimal values which you can view using the cat command. Something like this -
[jaypal~/Temp]$ cat hexdump.txt
0000000 2800 4620 1000 461e c800 461d a000 461e
0000020 8000 461e 2800 461e 5000 461f b800 461e
0000040 b800 461d 4000 461c a000 461e 3800 4620
0000060 f800 4621 7800 462a e000 4622 2800 463c
0000100 2000 464a 1000 4654 8c00 4693 5000 4661
0000120 7000 46ac 6c00 46d1 a400 4695 3c00 470a
0000140 b000 46ca 7400 46e9 c200 471b 9400 469e
0000160 9c00 4709 cc00 4719 4000 46b0 6400 46cc
Step III: The first column isn't really important to you. Columns 2 thru 9 are important. We will now strip the file using AWK so that you can convert it to decimal. We will add space so that we can consider each value as an individual field. We will also add "0x" to it so that we can pass it as a hexadecimal value.
[jaypal~/Temp]$ awk '{for (i=2;i<=NF;i++) printf "0x"$i" "}' hexdump.txt > hexdump1.txt
[jaypal~/Temp]$ cat hexdump1.txt
0x2800 0x4620 0x1000 0x461e 0xc800 0x461d 0xa000 0x461e 0x8000 0x461e 0x2800 0x461e 0x5000 0x461f 0xb800 0x461e 0xb800 0x461d 0x4000 0x461c 0xa000 0x461e 0x3800 0x4620 0xf800 0x4621 0x7800 0x462a 0xe000 0x4622 0x2800 0x463c 0x2000 0x464a 0x1000 0x4654 0x8c00 0x4693 0x5000 0x4661 0x7000 0x46ac 0x6c00 0x46d1 0xa400 0x4695 0x3c00 0x470a 0xb000 0x46ca 0x7400 0x46e9 0xc200 0x471b 0x9400 0x469e 0x9c00 0x4709 0xcc00 0x4719 0x4000 0x46b0 0x6400 0x46cc
Step IV: Now we will convert each hexadecimal value into decimal using printf function with AWK.
[jaypal~/Temp]$ gawk --non-decimal-data '{ for (i=1;i<=NF;i++) printf ("%05d ", $i)}' hexdump1.txt > hexdump2.txt
[jaypal~/Temp]$ cat hexdump2.txt
10240 17952 04096 17950 51200 17949 40960 17950 32768 17950 10240 17950 20480 17951 47104 17950 47104 17949 16384 17948 40960 17950 14336 17952 63488 17953 30720 17962 57344 17954 10240 17980 08192 17994 04096 18004 35840 18067 20480 18017 28672 18092 27648 18129 41984 18069 15360 18186 45056 18122 29696 18153 49664 18203 37888 18078 39936 18185 52224 18201 16384 18096 25600 18124
Step V: Formatting to make it easily readable
[jaypal~/Temp]$ sed 's/.\{48\}/&\n/g' < hexdump2.txt > hexdump3.txt
[jaypal~/Temp]$ cat hexdump3.txt
10240 17952 04096 17950 51200 17949 40960 17950
32768 17950 10240 17950 20480 17951 47104 17950
47104 17949 16384 17948 40960 17950 14336 17952
63488 17953 30720 17962 57344 17954 10240 17980
08192 17994 04096 18004 35840 18067 20480 18017
28672 18092 27648 18129 41984 18069 15360 18186
45056 18122 29696 18153 49664 18203 37888 18078
39936 18185 52224 18201 16384 18096 25600 18124

Resources