Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: Pratik4891
620
Posted By stomp
You may use sed: sed -r -i -e...
You may use sed:

sed -r -i -e 's/$$SCHEMA_NAME/test/' yourfile.xml
if your SCHEMA_NAME is in the shell variable 'schema', you can use this:


sed -r -i -e 's/$$SCHEMA_NAME/'"$schema/"...
620
Posted By MadeInGermany
If you have bash version 4: #!/bin/bash #...
If you have bash version 4:
#!/bin/bash
# bash version 4 required

# associative array
declare -A AR

# read file into array
while IFS="=" read key val
do
AR[$key]=$val
done < FileB
#...
620
Posted By RudiC
How about sed -f <(sed 's/^/s=/; s/$/=/' file2)...
How about
sed -f <(sed 's/^/s=/; s/$/=/' file2) file1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root xmlns="http://aaa/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema"...
1,339
Posted By Makarand Dodmis
try ls -ltr | egrep -i "ABC_DEF|NN" ...
try

ls -ltr | egrep -i "ABC_DEF|NN"

---------- Post updated at 08:04 AM ---------- Previous update was at 07:49 AM ----------

if you want both files to appear then

ls -ltr | egrep -i...
2,851
Posted By RudiC
In the BEGIN section, there no file open yet, so...
In the BEGIN section, there no file open yet, so you can't getline unless you redirect it.
Tryawk 'NR < 5 {HD[NR]=$0; next}
!((NR-5)%3) {FN="F"++i; for (j=1; j<=4; j++)...
5,208
Posted By rdrtx1
try also: awk '!a[$0]++ {of="file" ++fc; print...
try also:
awk '!a[$0]++ {of="file" ++fc; print $0 >> of ; close(of)}' RS= ORS="\n\n\n\n" file
5,208
Posted By Yoda
Sure, for each non-zero number of field records,...
Sure, for each non-zero number of field records, the program construct a variable s with value separated by RS (newline by default)
s = s ? s RS $0 : $0
Once a zero number of field record is...
4,801
Posted By Akshay Hegde
Try: $ awk...
Try:

$ awk '/^<d/{close(f);f=$1;gsub(/[[:punct:]]/,x,f); f=f".txt"}{print >f}' file

Resulting

$ ls dataset*.txt -1
dataset1.txt
dataset2.txt
dataset.txt
$ cat dataset.txt
<data-set>...
831
Posted By bartus11
Try:awk '{f=NR%x?NR%x:x;print > "file"f}' x=3...
Try:awk '{f=NR%x?NR%x:x;print > "file"f}' x=3 infile
831
Posted By alister
An alternative that does not require a...
An alternative that does not require a conditional:
awk '{print > "file" ((NR-1)%x)}' x=3 infile
If a 1-index solution is preferred, just add one to the modulus, (NR-1)%x+1.

Regards,
Alister
1,048
Posted By pravin27
How about this? awk -F"|"...
How about this?
awk -F"|" 'NR==FNR{a[$1]++;next}
a[$1]{print $1,a[$1]}' OFS="|" mainFile baseFile
1,048
Posted By ygemici
# awk -F'|' 'FNR==NR{a[$1]}($4 in...
# awk -F'|' 'FNR==NR{a[$1]}($4 in a){A[$4,x]++}END{for(i in A)print i FS A[i]}' base lookup
abc-001|3
bcd-001|2
cde-001|4
1,489
Posted By rangarasan
awk
Hi,

Try this one,


awk -v s="'" 'FNR==NR{gsub(s,"");a[$0]=$0;next;}!a[$0]{print $0;}' file2 file1


Cheers,
Ranga:)
4,891
Posted By itkamaraj
you need to end the here statement ftp -n...
you need to end the here statement

ftp -n -v -q winftp.principal.com >/infa/datafiles/GRP/Scripts/ftp_from_infa_dvcn.log<<END_SCRIPT
 
quote USER $FTP_USER
quote PASS $FTP_PASS
ascii
lcd...
3,114
Posted By Klashxx
awk -F\~ '{print $4}' test.dat|sort|uniq|wc -l
awk -F\~ '{print $4}' test.dat|sort|uniq|wc -l
3,114
Posted By balajesuri
Its awk -F not awk -FS $ awk -F"[|~|]+" '{print...
Its awk -F not awk -FS
$ awk -F"[|~|]+" '{print $4}' filename | sort | uniq | wc -l
3
3,114
Posted By ahamed101
awk -F\~ '{print $4}' test.dat | sort -u | wc -l ...
awk -F\~ '{print $4}' test.dat | sort -u | wc -l


--ahamed
3,114
Posted By Klashxx
a pure awk: awk -F"[|~|]+"...
a pure awk:
awk -F"[|~|]+" 'a[$4]==""{a[$4]=1;b++}END{print b}' test.dat
Or:
awk -F\~ '!a[$4]{a[$4]=1;b++}END{print b}' test.dat
3,114
Posted By ahamed101
Yet another one... awk -F'~'...
Yet another one...

awk -F'~' '{a[$4]++}END{print length(a)}' infile


Use nawk if solaris!

--ahamed
3,114
Posted By itkamaraj
$ awk -F"\|~\|" '{a[$4]++;next}END{for(i in...
$ awk -F"\|~\|" '{a[$4]++;next}END{for(i in a){print a[i],i}}' input.txt
6 1023353
2 1014486
2 1015104
13,319
Posted By durden_tyler
The call to the open function is incorrect. Have...
The call to the open function is incorrect. Have a look at the online Perl documentation:

open - perldoc.perl.org (http://perldoc.perl.org/functions/open.html)

Since you'd open a file, you...
13,319
Posted By Skrynesaver
No it's actually creating an entry using the 3rd...
No it's actually creating an entry using the 3rd field ass a key for the hash and the entire record as the value.

At this point we have slurped the entire file into an array and because we are...
13,319
Posted By durden_tyler
$ $ $ cat f40 ...
$
$
$ cat f40
9924873|20111114|00000000000013013|130|13|10/15/2010 12:36:22|W860944|N|00
9924873|20111114|00000000000013009|130|09|10/15/2010 12:36:22|W860944|N|00...
13,319
Posted By Skrynesaver
#!/usr/bin/perl use strict; use warnings; ...
#!/usr/bin/perl
use strict;
use warnings;

open (my $data , '<', $ARGV[0])|| die "could not open $ARGV[0]:\n$!";
my @array=(<$data>);
my @sorted=sort {(split(/\|/,$a))[2]<=>(split(/\|/,$b))[2]}...
971
Posted By ygemici
try justdoit codes ;) # ./justdoit Please...
try justdoit codes ;)
# ./justdoit
Please give your value(s) [ 1 2 3 4 ] ? 1 3 5
Please only give an input value for [1 2 3 4] with space!!

Please give your value(s) [ 1 2 3 4 ] ? 1 5...
Showing results 1 to 25 of 47

 

Featured Tech Videos

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