Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: rohit_shinez
3,273
Posted By rbatte1
Could you just do this?:-tr "§" "|" < inputfile >...
Could you just do this?:-tr "§" "|" < inputfile > outputfile




I hope that this helps,
Robin
8,182
Posted By wisecracker
I disagree, the image distinctly shows a DIAMOND,...
I disagree, the image distinctly shows a DIAMOND, period.
Your code:
bazza@amiga-MacBookPro:~/Desktop/Code/Shell$ ./DIAMOND_CXL.sh
Enter the mininum number: 4
Enter the maximum number: 7
* *...
7,016
Posted By RudiC
I think it is sorted properly as sort has been...
I think it is sorted properly as sort has been told. If you want the result in descending order, use the -r (reverse) flag.


How about

{ read; echo $REPLY; sort -t"|" -k7bgr; }...
8,182
Posted By Chubler_XL
I was demonstrating how the original code we were...
I was demonstrating how the original code we were asked to simplify in Post #1 works .
I believe this was indicated as doing what was required.


Here is a solution using dash. I make use of a...
8,182
Posted By wisecracker
Hi C688, Chubler_XL... Be aware they only...
Hi C688, Chubler_XL...

Be aware they only work with MIN=1...
Try 'MIN=6' and 'MAX=11'.

I also made the mistake of thinking MIN was also the number of stars in each horizontal plot.

The OP...
8,182
Posted By RudiC
faint memories... awk diamond code golf (just for...
faint memories... awk diamond code golf (just for fun!) (https://www.unix.com/shell-programming-and-scripting/269631-awk-diamond-code-golf-just-fun.html)
1,320
Posted By bakunin
Yes, of course: there is the date command, which...
Yes, of course: there is the date command, which will tell you the current time and date. Use a format specifier to get the part of the date you want to base your condition on and use if... to...
2,124
Posted By Don Cragun
Great. I can't wait to see what you come up with...
Great. I can't wait to see what you come up with to meet these requirements. How you will fit 12399999 into a 5 character id field and how you will fit engineer and doctor into a 5 character role...
2,124
Posted By Don Cragun
Given that the sample output you provided is not...
Given that the sample output you provided is not formatted at all like you said you wanted and, instead, just changes the <comma>s in your CSV file to <space>s; I don't know whether you want the...
890
Posted By Aia
You must protect $input by surrounding it with {}...
You must protect $input by surrounding it with {} like ${input} otherwise the shell thinks
you want to expand a variable named $input_string2 which has not been defined.
7,675
Posted By MadeInGermany
Replace the sed line by this sed line sed -n -e...
Replace the sed line by this sed line
sed -n -e '/^ *CREATE TABLE /{' -e ':L' -e '/) *$/{' -e 'p;d' -e '}' -e 'N; bL'It prints the block between "CREATE TABLE " and the closing ")"
913
Posted By RudiC
Please look back to your post#1. Where did you...
Please look back to your post#1. Where did you state THAT?

Howsoever, try
DT=$(date +"%b%y" -d"-1month")
ls -1 *.txt | while read FN; do [[ "${FN^^}" =~ "${DT^^}" ]] && echo $FN; done...
3,650
Posted By rbatte1
Do you mean that there is an existing file that...
Do you mean that there is an existing file that will get overwritten and you want the time of that? Okay, well you will have to record it and then set the value afterwards.

Something like a...
859
Posted By Skrynesaver
That's a shell command ;) I can break it into...
That's a shell command ;) I can break it into digestible chunks if you wish

perl -ne ' #Call the Perl interpreter and iterate over every line in the files listed as arguments with...
859
Posted By Skrynesaver
[skrynesaver@busybox]$cat tmp.dat name,id,flag ...
[skrynesaver@busybox]$cat tmp.dat
name,id,flag
apple,1,Y
apple,2,N
mango,1,Y
mango,2,Y
[skrynesaver@busybox]$ perl -ne 'chomp;@r=split/,/; push @{$fields{$r[0]}},$r[1] if $r[2] eq "Y";}{for...
2,169
Posted By Don Cragun
Huh? You have to remove the header before you...
Huh? You have to remove the header before you copy the source file and then you will copy the source file and then you will copy the source file (to a country directory) and then you will remove the...
2,169
Posted By RudiC
If your shell (which you failed to mention) is a...
If your shell (which you failed to mention) is a recent bash, try (yes, admittedly deploying the unloved and sometimes dangerous eval)
X=$(<property.txt)
for PN in $(eval echo...
5,711
Posted By Scrutinizer
Independent of name of header: sed '1s/^/hi_/;...
Independent of name of header:
sed '1s/^/hi_/; 1s/,/,hi_/g' test.csv

GNU sed (-r), BSD sed (-E):
sed -r '1s/(^|,)/&hi_/g' test.csv
547
Posted By Don Cragun
Note that there are two fields in your input...
Note that there are two fields in your input file; not just one.

Note that the format string presented to printf needs to be a single operand and (since double-quotes do not nest), the format...
630
Posted By rdrtx1
awk ' BEGIN { ar["A"]="double"; ...
awk '
BEGIN {
ar["A"]="double";
ar["F"]="int";
ar["H"]="string";
ar["K"]="int";
}
{
for (i=1; i<=NF; i++) {
split($i, av, "_");
print $i, ar[av[2]] ((i==NF) ? "" : ",")
...
630
Posted By RavinderSingh13
Hello rohit_shinez, Could you please try...
Hello rohit_shinez,

Could you please try following and let me know if this helps you.
Let's say we have following Input_file(as an example):

cat Input_file...
630
Posted By RavinderSingh13
Hello rohit_shinez, Could you please try...
Hello rohit_shinez,

Could you please try following and let me know if this helps.
1st code:

awk -F, '{for(i=1;i<=NF;i++){sub(/_A$/,"& double",$i);sub(/_H$/,"& String",$i);sub(/_K$/,"&...
Forum: Programming 12-18-2016
6,889
Posted By RudiC
Does your hadoop fs allow for the -b option to...
Does your hadoop fs allow for the -b option to output byte sizes?
If not: your problem has been solved umpteen times in these fora; try searching in here...
1,205
Posted By RavinderSingh13
Hello rohit_shinez, Could you please try...
Hello rohit_shinez,

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

awk '($0 ~ /ERROR|WARNING/){Q=$0;next} ($1 ~ /ID/ && Q){print "There is Error for ID " $NF;Q=""}' ...
1,205
Posted By itkamaraj
awk '($0 ~ /ERROR/ && $0!~/IGNORE/){Q=$0;next}...
awk '($0 ~ /ERROR/ && $0!~/IGNORE/){Q=$0;next} ($0 ~ /ID/){print Q ORS "There is Error for ID " $NF}' test.txt
Showing results 1 to 25 of 70

 

Featured Tech Videos

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