Search Results

Search: Posts Made By: Ophiuchus
6,788
Posted By RudiC
The mtime of the directory might be an indicator...
The mtime of the directory might be an indicator of when the file was moved.
6,788
Posted By MadeInGermany
If the mtime shown with ls -l was manipulated, ls...
If the mtime shown with ls -l was manipulated, ls -lc will show it (it shows the ctime, the last change of the attributes).
6,342
Posted By Don Cragun
The standards specify that every conforming...
The standards specify that every conforming version of awk must support delete array[subscript]. Some implementations of awk also support delete array, but that is not required by the standards. On...
6,342
Posted By Chubler_XL
How about this: awk -F"<|>" ' BEGIN{print...
How about this:

awk -F"<|>" '
BEGIN{print "ProjectName|NameID|STX-STY|PRX-PRY|OD-ODF|ODRangeStart|ODRangeStop"}
/ProjectName/{printf "%s",$3}
/<.StructData>/{
for(i=1; i<=rngln; i++) {
...
6,342
Posted By stomp
Hi, I suggest to use an XML-Tool for parsing...
Hi,

I suggest to use an XML-Tool for parsing an XML-File. Look at the thread here for some tools:

https://www.unix.com/shell-programming-and-scripting/270103-extract-value-xml-file.html
...
1,552
Posted By Scrutinizer
Alternatively, there is also an option in Excel...
Alternatively, there is also an option in Excel to use "fixed width" instead of a field separator when reading data. When I tried it only one of the thin dividing lines needed to be moved by one...
1,552
Posted By RudiC
Look at lines 4 - 6 in your sample in post#1: ...
Look at lines 4 - 6 in your sample in post#1:



.
.
.
VLL VMI VKO VER # $0 ~ HD {getline --> found the header (HD); discard and read new line
39 5 # ...
1,552
Posted By RudiC
Sliding in an output delimiter is not a difficult...
Sliding in an output delimiter is not a difficult task, but finding empty fields in the input when the input delimiters are a couple of spaces, and the input fields are space padded, too, is NOT a...
1,552
Posted By Scrutinizer
Try something like this: awk '{i=1} NR==1{print...
Try something like this:
awk '{i=1} NR==1{print $1,$4; i=2}{print $i; print $(i+1), $(i+3)}' RS= FS='\n' file
1,570
Posted By Chubler_XL
I'm not aware of any tool like that. You could...
I'm not aware of any tool like that. You could simply print out the contents of the arrays in the END block like this:

awk '
BEGIN {lines=0; column_count=0}
$2 !~ /=/ || NF != 3 {next}
!...
1,570
Posted By Chubler_XL
Update to rdrtx1's solution (in red) to cover the...
Update to rdrtx1's solution (in red) to cover the duplicate field(s) qualification.

awk '
BEGIN {lines=0; column_count=0}
$2 !~ /=/ || NF != 3 {next}
! column[$1]++ {columns[column_count++]=$1}...
1,570
Posted By rdrtx1
awk ' BEGIN {lines=0; column_count=0} $2 !~...
awk '
BEGIN {lines=0; column_count=0}
$2 !~ /=/ || NF != 3 {next}
! column[$1]++ {columns[column_count++]=$1}
$1 ~ /^STAGE*$/ {lines++}
{column_data[$1, lines]=$3}
END {
for (i=0;...
1,570
Posted By RudiC
This awk -F"[ =]+" ' BEGIN {HD =...
This
awk -F"[ =]+" '
BEGIN {HD = "STAGE|ID|NAME|TYPE|DFRUL|ADDR|RRUL|SPRR|ISGALW|ISUTWD"
for (MX=n=split (HD, HDArr, "|"); n>0; n--) SRCH[HDArr[n]]
...
4,808
Posted By RudiC
Tryawk ' {match ($0, /font="[^"]*"/) ...
Tryawk '
{match ($0, /font="[^"]*"/)
FNT = substr ($0, RSTART+6, RLENGTH-7)
gsub (/^\t|<[^>]*>/, _)

if (FNT == 9) {LVL = 1
printf...
6,633
Posted By Scrutinizer
Awk does not have consistent support for...
Awk does not have consistent support for hexadecimal values. With gawk try the --non-decimal-data option (or try something like Corona688 posted in the link in post #2)
1,535
Posted By Aia
Your input files are not consistent. Your...
Your input files are not consistent.

Your original input file has a header line with Min-Range Max Range


The second input file you are complaining about does not have that header line.

...
1,535
Posted By RudiC
Any attempts from your side? ---------- Post...
Any attempts from your side?

---------- Post updated at 12:32 ---------- Previous update was at 10:54 ----------

Howsoever, tryawk '
NR > 1 {DELTA = $2 - $1
n=split (DELTA, T, "")
...
1,401
Posted By Don Cragun
Thank you for sharing your results. It will help...
Thank you for sharing your results. It will help other people reading this thread understand how you solved your problem.

For future reference, note that as long as a list of variables are all...
1,401
Posted By MadeInGermany
It prints when E is met. If there is no E nothing...
It prints when E is met. If there is no E nothing is printed.
Instead it must print at the end of each block, that is either when ZYX is met or at the END, and if it's not line 1.
Consider a...
9,232
Posted By senhia83
Try, untested awk -v x=0 '(NR == FNR) {...
Try, untested

awk -v x=0 '(NR == FNR) { if(length > x) x = length;next } { printf("%-"x"s\n", $0) }' file file
9,232
Posted By vgersh99
echo '12345' | awk -v m=10 '{printf("[%-10s]\n",...
echo '12345' | awk -v m=10 '{printf("[%-10s]\n", $0)}'
[12345 ]
2,077
Posted By jim mcnamara
This is bash. You can do what you want with far...
This is bash. You can do what you want with far less code.

#!/bin/bash

# this outer loop of the code is here to put the strings in array variables
# you do not have to do it this way

for i...
2,077
Posted By Chubler_XL
Arrays are not a very good way to store this data...
Arrays are not a very good way to store this data you could simplify the code by using strings:


STR=81UV78UV183UV89800
for val in ${STR//UV/ }
do
echo $val
doneAnyway here is the method...
2,690
Posted By Don Cragun
I'm glad my script is helping you. And, as...
I'm glad my script is helping you.

And, as junior-helper said, the commands:
if [ ! -d "$dd" ]
then mkdir "$dd"
fi
checks to see of the destination directory ($dd) exists. If it does not...
2,690
Posted By junior-helper
Indeed he is! :b: Let me quote a few lines...
Indeed he is! :b:

Let me quote a few lines from man test:
NAME
test - check file types and compare values

SYNOPSIS
test EXPRESSION
test

[ EXPRESSION ]
...
Showing results 1 to 25 of 59

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