Search Results

Search: Posts Made By: Kalia
1,819
Posted By Don Cragun
Homework and coursework questions can only be...
Homework and coursework questions can only be posted in the Homework & Coursework forum (https://www.unix.com/homework-coursework-questions/) under special homework rules...
2,035
Posted By RudiC
What about non-space non-printable characters?...
What about non-space non-printable characters? Would you consider a file with 2 or more <linefeed> chars a removal candidate although it has two+ empty lines? Or, a <BEL> (0x07, ^G, \a) char?
2,035
Posted By drysdalk
Hi, There's no easy way to do what you want...
Hi,

There's no easy way to do what you want to do with find, or at least not based on a simple -type test. As you've previously been advised, an empty file is defined as a file containing 0 lines...
2,904
Posted By MadeInGermany
Or let sed do the global "-" substitution: sed...
Or let sed do the global "-" substitution:
sed '1{ x; s/.*/NAME COUNTRY_CODE/; p; s/[^ ]/-/g; G; }' test.txt
In line 1, save to H-buffer, put the title, print, substitute all non space with "-";...
2,904
Posted By RudiC
sed '1i NAME COUNTRY\n---- ------------' file ...
sed '1i NAME COUNTRY\n---- ------------' file
NAME COUNTRY
---- ------------
UK 1234
USA 2354
AUS 2253
IND 4256

or
sed -e '1i NAME COUNTRY' -e '1i ---- ------------' file
3,503
Posted By MadeInGermany
Print the previous (stored) lines if s[$0] == 4...
Print the previous (stored) lines if s[$0] == 4 and the current line for s[$0] > 4
awk '{p=$1; $1=""; pid[$0,++s[$0]]=p} s[$0]==4 {for (i=1; i<=s[$0]; i++) print pid[$0,i] $0} s[$0]>4 {print p,$0}'...
2,167
Posted By Don Cragun
Sorry. Our mistake. Try changing: if [ grep...
Sorry. Our mistake. Try changing:
if [ grep -q $pattern "$filename" ]; thento:
if grep -q "$pattern" "$filename"; then
You don't need or want to use test (AKA [ ... ]) here; you just want to...
3,503
Posted By MadeInGermany
Then, instead of the whole line, compare only...
Then, instead of the whole line, compare
only column$2
awk 's[$2]++<4' test.txtor
the whole line($0) but column$1
awk '{x=$0; $1=""} s[$0]++<4 {print x}' test.txt<4 means up to 4 instances are...
1,387
Posted By MadeInGermany
I assume you want to run your script from...
I assume you want to run your script from crontab.
You can store the current job name in a file.
Before you do it, compare it with the old file contents; if different then send mail.
Showing results 1 to 9 of 9

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