Search Results

Search: Posts Made By: znesotomayor
1,557
Posted By Aia
substr() is a built-in function in AWK, to...
substr() is a built-in function in AWK, to extract a consecutive sequence of characters from inside a string.

substr($1, 5, 7) extracts from field 1, 7 characters, starting at character 5.

NR...
1,557
Posted By pravin27
Hi RudiC, I think solution need 6 character to...
Hi RudiC,
I think solution need 6 character to extract instead 7 substr($1, 5, 7)

Thanks
Pravin
1,557
Posted By RudiC
Try ls home/sysad/PROS* | awk 'NR == FNR...
Try ls home/sysad/PROS* | awk 'NR == FNR {T[substr($1, 5, 7)] = $1; next} !($1$2 in T) {print "PROS" $1 $2}' FS="|" - file1
PROS0940134
PROS0941268
PROS0800445
PROS0491896
3,044
Posted By pravin27
Convert your date to seconds and then compare. ...
Convert your date to seconds and then compare.
dProcDate="2016-02-29"
dCurrent="2016-05-31"

dProcDate_sec=$(date -d"$dProcDate" '+%s')
dCurrent_sec=$(date -d"$dCurrent" '+%s')

if [...
2,258
Posted By kshji
Maybe this example helps use to make comparing...
Maybe this example helps use to make comparing little easier in shell. You can add breaks as you like.

for file in *.txt
do
stat="DEPTH"
while IFS="," read f1 f2 DEPT SDEPT rest
do...
899
Posted By RudiC
Unfortunately you don't mention your system's...
Unfortunately you don't mention your system's info like the shell you use. In a recent bash offering "extended pattern matching", you could tryshopt -s extglob
ls...
899
Posted By Don Cragun
A quick and dirty way to get what you want would...
A quick and dirty way to get what you want would be:
ls ar[0-9][0-9][0-9][0-9][0-9][0-9][0-9][a-z][0-9][0-9].zip > OK
ls *.zip | grep -v -F -f OK
rm -f OK
2,071
Posted By Aia
Would any of these work?: ls | perl -ne...
Would any of these work?:

ls | perl -ne '$p=1 if /h15.zip$/; print if $p'
ar0330016h15.zip
ar0330263c16.zip
ar0330267a16.zip

ls | perl -ne 'print if $_ ge "ar0330016h15.zip"'...
772
Posted By Don Cragun
Try: ls ab*1[56].zip
Try:
ls ab*1[56].zip
1,871
Posted By RudiC
If you use awk anyhow, why not do everything with...
If you use awk anyhow, why not do everything with it?find *.csv | awk -F "." '{print substr ($1, length($1)-3)}'
1502
1501
1501
1501


Shell version (recent bash): while read FN; do...
1,429
Posted By RudiC
What does "append on the file" mean?
What does "append on the file" mean?
1,030
Posted By Don Cragun
I am totally confused by the description of your...
I am totally confused by the description of your problem. You start off with a file of information extracted from a database into a character separated values file with vertical-bar as the...
1,009
Posted By looney
Hi Znesotomayor, you can also save your excel...
Hi Znesotomayor,
you can also save your excel as pipe delimited.Keeping JunJun,Binay as it is.
follow the below steps.

press window tab
type regional and language
go to additional settings...
1,009
Posted By rdrtx1
try: awk -F, '{$2=$2 "," $3; $3=$4; print...
try:
awk -F, '{$2=$2 "," $3; $3=$4; print $1,"\"" $2 "\"", $3}' OFS=, file1.csv

or
awk -F, '{$2="\"" $2 "," $3 "\""; $3=$4; print $1, $2, $3}' OFS=, file1.csv
1,315
Posted By Don Cragun
From your first post in this thread: To meet...
From your first post in this thread:

To meet your condition, we first have to be able to identify what is in Field 4 of file1.txt. And, when your field separator is a variable number of spaces,...
1,315
Posted By RavinderSingh13
Hello znesotomayor, Could you please try...
Hello znesotomayor,

Could you please try following and let me know if this helps you.

awk 'NR==1{;print}FNR==NR && FNR>1{A[$3]=$1 OFS $2;next} ($2 in A){print $1 OFS A[$2] OFS $2}' OFS="\t"...
3,924
Posted By RavinderSingh13
Hello znesotomayor, Could you please enclose...
Hello znesotomayor,

Could you please enclose output file with "sql_input_file.sql". It should work then. You can hit thank you button present at left corner if you want to thank anyone here.
...
3,924
Posted By RavinderSingh13
Hello znesotomayor, on a Solaris/SunOS...
Hello znesotomayor,

on a Solaris/SunOS system, change awkto /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk.
If you doesn't have Solaris/SunOS then please let us know which os you have with...
3,924
Posted By rbatte1
I would suggest removing the credentials from the...
I would suggest removing the credentials from the command line, else you publish them to anyone who can run a simple ps on your server. At the same time, you could actually stack up simple commands...
3,924
Posted By RavinderSingh13
Hello znesotomayor, You could try below and...
Hello znesotomayor,

You could try below and let me know if this helps you.

awk 'BEGIN{print "set pagesize 50000;" ORS "set feedback off;" ORS "set linesize 1000;" ORS "set numformat...
1,696
Posted By sea
In that case i was refering to: awk ...
In that case i was refering to:
awk '/10-Aug-2020/ {print $0}' file1.txt
:p
(i tend to use/(believe that) variables (are) just like regular strings)
BTW Don, i belive you're missing a -F,.
...
1,696
Posted By Don Cragun
That will print each line containing the literal...
That will print each line containing the literal string RANGE anywhere on the line. But, you're on the right path. Try:
RANGE=10-Aug-2020
awk -v RANGE=$RANGE -F"," '$2 ~ RANGE {print $0}'...
1,445
Posted By RavinderSingh13
Hello znesotomayor, Following may help you...
Hello znesotomayor,

Following may help you in same.

cat file23
1|203|3|31243|5341|6452|623|22|00|01
3|45345|123214|6534|3423|6565|643|343|232|10

awk -F"|" '($1==1 && $3==3 && $5==5341)'...
1,479
Posted By RudiC
How about - if your grep allows for the -B option...
How about - if your grep allows for the -B option - grep -B1 Error file1
GET /Sun/Cellular/version1/12
HTTP/1.0 100 Internal Error
--
GET /Sun/Cellular/version1/13
HTTP/1.0 100 Internal Error
...
1,479
Posted By RavinderSingh13
Hello znesotomayor, Could you please try...
Hello znesotomayor,

Could you please try following and let me know if this helps.


awk '/\/Sun\/Cellular\/version1\/[0-9]*/ {print $0;getline;print $0}' Input_file


Output will be as...
Showing results 1 to 25 of 27

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