Search Results

Search: Posts Made By: shamrock
1,450
Posted By vgersh99
not when $NF is 0
not when $NF is 0
10,374
Posted By Neo
Hi rprpr, unix.com is not a place where the...
Hi rprpr,

unix.com is not a place where the members do your work for you, regardless of if it is homework, personal or professional work.

We are here to help you do your work, not do your work...
1,108
Posted By cero
Another important information is how the scripts...
Another important information is how the scripts are started.
Would it be possible to have a wrapper script to start those 3 scripts in background and use the wait command to wait for all of them to...
2,859
Posted By RudiC
Wouldn't it be nice to tell people the sort...
Wouldn't it be nice to tell people the sort criteria?
1,548
Posted By RudiC
How about paste -s -d" \n" file | tr -s '...
How about
paste -s -d" \n" file | tr -s ' ' ' '
array([ 0.03015278, 0.02738889, 0.0125 , 0.00875 , 0.00736806, 0.00672917, 0.00763889, 0.01044444, 0.01178472, 0.01470139, 0.02020833,...
1,631
Posted By balajesuri
If you know the first and last ID, why not...
If you know the first and last ID, why not generate the sequence yourself:
[user@host ~]$ seq -f "RETT-%.0f" 1 5
RETT-1
RETT-2
RETT-3
RETT-4
RETT-5
968
Posted By RavinderSingh13
Hello Shamrock, Thank you for nice code,...
Hello Shamrock,

Thank you for nice code, would like to add here IMHO. Above code gives extra string at last from ActiveTechorActiveClerk, so to remove them too just a little modification of you...
3,859
Posted By drl
Hi. Also a script with a utility written in...
Hi.

Also a script with a utility written in perl:
#!/usr/bin/env bash

# @(#) s1 Demonstrate combinations of 2 from list of strings in file.

# Utility functions: print-as-echo,...
2,363
Posted By Scrutinizer
Another way to count the number of (non-hidden)...
Another way to count the number of (non-hidden) entries in a directory in pure shell, which is also more accurate (it will count filenames that contain newlines correctly):
set -- *; echo $#

or...
2,045
Posted By RudiC
Small simplification of shamrock's well working...
Small simplification of shamrock's well working proposal:
awk 'BEGIN{while(getline < "f1" > 0) x[$2]=$0} $2 in x && $3>40 && $4>49 {print x[$2]}' f2
1 100 A C
1 1000 - G
8,120
Posted By RudiC
Orawk '{$2+=0}1' CONVFMT="%.2f" file
Orawk '{$2+=0}1' CONVFMT="%.2f" file
1,753
Posted By Don Cragun
Probably due to EAGL€'s insistence on posting...
Probably due to EAGL€'s insistence on posting extremely long one-liners, you missed that there is also a trailer line being printed. To take care of that you need to add an END clause...
END{printf...
1,222
Posted By Chubler_XL
Try: awk '!H[$2]++' infile Or using sort...
Try:
awk '!H[$2]++' infile

Or using sort you could sort on 2nd field and print 1st of an equal run, then re-sort back into numeric order on field 1:

sort -u -k 2,2 infile | sort -n
Forum: Programming 02-29-2016
2,960
Posted By Don Cragun
Hi yifangt, You are aware that you can access...
Hi yifangt,
You are aware that you can access shell scripts from C code using the system() function, aren't you?
3,240
Posted By jlliagre
Although it is not a well known fact, all awk...
Although it is not a well known fact, all awk releases are able to retrieve the current epoch time by standard :
$ awk 'BEGIN {srand();time=srand();print time}'
1416532245
2,667
Posted By Corona688
This is implementation dependent. $ strace...
This is implementation dependent.

$ strace ed file.txt 2>trace
q
$ grep "/tmp/" strace
open("/tmp/tmpfpHh7ZE", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
unlink("/tmp/tmpfpHh7ZE") = 0
$
...
2,707
Posted By jim mcnamara
Try your code on the following March 30, 2014. ...
Try your code on the following March 30, 2014. There is no February 30th.
2,682
Posted By Don Cragun
RudiC, When I try: sed -E 's/(;|.)$/;/'...
RudiC,
When I try:
sed -E 's/(;|.)$/;/' MyFile.csv
it replaces the last character on every line with a semicolon instead of adding a semicolon to the end of lines that don't already have one.
...
884
Posted By Akshay Hegde
Op should be csv, I think
Op should be csv, I think
17,325
Posted By drl
Hi. Standard HPUX utility csplit is designed...
Hi.

Standard HPUX utility csplit is designed for this. For example, assuming a well-formatted file, this script:
#!/usr/bin/env bash

# @(#) s1 Demonstrate context splitting, csplit.
...
1,440
Posted By alister
What have you tried? You should be able to solve...
What have you tried? You should be able to solve this new problem by modifying either awk suggestion.

Also, pay attention to how a moderator edited your original post. Use code tags for code and...
39,032
Posted By Ditto
Understood, however, the only issue I was trying...
Understood, however, the only issue I was trying point out was that because of that bit-wise fun, depending on the error code sent back, it *could* come back as 0, despite throwing an error.
(ie if...
6,596
Posted By Chubler_XL
Try this ls *.csv | sort -t_ -k3,3n
Try this ls *.csv | sort -t_ -k3,3n
1,539
Posted By in2nix4life
awk -F'-[0-9].*' '{print $1}'
awk -F'-[0-9].*' '{print $1}'
11,309
Posted By RudiC
Putting the quotes at the right places will make...
Putting the quotes at the right places will make it work:cat file | while read l_line; do echo "$(echo "$l_line" | awk -F',' '{OFS = ",";$1=""; print $0}')"; done
,item, 12345678
,item, ...
Showing results 1 to 25 of 39

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