Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: sdf
778
Posted By sdf
Thanks, thats what I needed. Double dates are not...
Thanks, thats what I needed. Double dates are not serious.
778
Posted By sdf
awk remove line
I would like to remove lines with certain pattern but only Estimate: and Realised: in USD and Date: shall be output. The order of the currency are mixed.
Output
I failed on awk with sub, gensub and...
3,083
Posted By sdf
awk search patterns from file in another
I would like to grep for aaa and bbb and ccc from one line in file1.txt in any order on a line on file2.txt

file1.txt
aaa bbb ccc
ddd fff ggg
hhh ddd jjj
jjj cccfile2.txt
aaa bbb ccc ddd fff...
15,109
Posted By sdf
Thanks, both work perfectly!
Thanks, both work perfectly!
15,109
Posted By sdf
How to ignore characters and print only numbers using awk?
Input:
ak=70&cat15481=lot=6991901">Kaschau (1820-1840)
ak=7078&cat15482=lot=70121">Principauté (1940-1993)
ak=709&cat=lot15484=70183944">Arubas (4543-5043)Output:
70 15481 6991901
7078 15482 70121...
1,063
Posted By sdf
awk split numbers
I would like to split a string of numbers "1-2,4-13,16,19-20,21-25,31-32" and output these with awk into

-dFirstPage=1 -dLastPage=2 file.pdf -dFirstPage=4 -dLastPage=13 file.pdf -dFirstPage=16...
960
Posted By sdf
With the above sample its difficult to guess...
With the above sample its difficult to guess where the line break shall be. At field 11 or at the number 183103 etc. Can you please provide more details where the line shall be broken?
789
Posted By sdf
If the input file has only 3 columns, than the...
If the input file has only 3 columns, than the script can be shortened to:

awk 'BEGIN{FS=OFS="\t"}{ print $1, $2 "\n\t" $3}' infile >outfile
2,058
Posted By sdf
The numeric comparisons work!
The numeric comparisons work!
2,341
Posted By sdf
Filename vo is not the problem. Try this code....
Filename vo is not the problem. Try this code. Have changed sub to gsub

awk 'BEGIN{FS=OFS="'"}{for(i=1;i<=NF;i++) if($i ~ /user.*,user.*|Immediate Backup|whatever/)...
2,058
Posted By sdf
Odd, checked your code on gawk 3 and 4 and they...
Odd, checked your code on gawk 3 and 4 and they appear.
2,058
Posted By sdf
awk 'NR==FNR{a[i++]=$1;next}{for(x=1;x<=i;x++)...
awk 'NR==FNR{a[i++]=$1;next}{for(x=1;x<=i;x++) if( a[x] >= $1 && a[x] <= $2) print a[x]}' file1 file2 >outfile

---------- Post updated at 12:06 PM ---------- Previous update was at 11:50 AM...
2,341
Posted By sdf
Is this working? Changed the script to multiple...
Is this working? Changed the script to multiple patterns.

awk 'BEGIN{FS=OFS="'"}{for(i=1;i<=NF;i++) if($i ~ /user.*,user.*|Immediate Backup|whatever/) gsub(/,/,"Xox9870563xoX",$i)};1' infile...
2,428
Posted By sdf
Would this solve the splitting of the content...
Would this solve the splitting of the content into multiple files?

All files in same directory:
awk 'BEGIN{FS="/"}{if($NF ~ /note.*txt/) y=$NF; if($NF !~ "txt") print $0 > y }' infileor

All...
876
Posted By sdf
Look at this site....
Look at this site. (http://www.pement.org/awk/awk1line.txt)

For every 108th line
awk 'ORS=NR%108?",":"\n"' input >outputFor every 27th line
awk 'ORS=NR%27?",":"\n"' input >output
1,489
Posted By sdf
What about this one? awk...
What about this one?

awk '/<\/TCPSampler/,/rm.*resp.data/{$0 ~ /gIntegraHost/;sub(/gIntegraHost/,"gTestRunHost",$0)};1' infile >outfile
2,621
Posted By sdf
In the array b[j] the length of the longest line...
In the array b[j] the length of the longest line of each file is stored. The array can only be activated after every input-file. In the END statement the printout with the padded blanks in the fields...
2,621
Posted By sdf
See attached script with explanation. #...
See attached script with explanation.

# https://www.unix.com/shell-programming-scripting/188853-help-aligning-content-txt-file.html
{ NR>1 && FNR==1 ? l=length($0) && a[i++]= "\n" $0 :...
2,621
Posted By sdf
OK I have another try. Its getting more and more...
OK I have another try. Its getting more and more difficult. I checked it with several files and this script and it should work

awk -f transpose_adjust_field.awk infiles*...
2,621
Posted By sdf
Is this what you need? awk '{NR>1 && FNR==1...
Is this what you need?

awk '{NR>1 && FNR==1 ? a[i++]="\n" $0 : a[i++]=$0}{ if(length($0) > l) l=length($0)+1} END{ for(j=1;j<=i;j++) printf("%-"(l+1)"s,",a[j-1])}' infiles* >outfile
2,621
Posted By sdf
Then how does the input look like? Like...
Then how does the input look like?

Like this?

Input:
TEST WELCOME HI HELLO UNIX SHELL SCRIPTING
SCRIPTING SHELL UNIX HELLO HI WELCOME TESTDesired output:
TEST ,WELCOME ,HI ...
4,412
Posted By sdf
Post an example of such a .XML file.
Post an example of such a .XML file.
1,738
Posted By sdf
use curl with the option --trace-ascii -...
use curl with the option --trace-ascii - logfile.txt

example:

curl -o file2dl "http://fileonserver" --trace-ascii - >> logfile.txt
2,621
Posted By sdf
Are there several files and for every file the...
Are there several files and for every file the longest word shall be the measure for the field length?

---------- Post updated at 10:25 PM ---------- Previous update was at 04:42 PM ----------
...
2,621
Posted By sdf
awk 'BEGIN{ORS=""} {printf("%-9s", $1)}' infile...
awk 'BEGIN{ORS=""} {printf("%-9s", $1)}' infile >outfile
Showing results 1 to 25 of 116

 

Featured Tech Videos

All times are GMT -4. The time now is 02:56 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy