Search Results

Search: Posts Made By: rakeshp
1,499
Posted By jim mcnamara
Using the filenames as the ONLY time reference: ...
Using the filenames as the ONLY time reference:
newest=$( ls abcd*| sort -n -k2 -t '.' | tail -1 )

Using file mtimes (last time written to, the default for ls -l )
newest=$( ls -rt '.' | tail...
1,499
Posted By RudiC
That depends on what you call "latest". If you...
That depends on what you call "latest". If you can make ABSOLUTELY sure the name's time stamp is correct, can't be tampered with, and coincides with the file creation, why not use it? If you don't,...
3,895
Posted By nezabudka
if we only assume that the fifteenth field is the...
if we only assume that the fifteenth field is the last at the same time

awk 'BEGIN {FS="|"; OFS="|"} {gsub("[^a-zA-Z0-9 ]", "", $FN)} 1' file


Please use CODE tags as required by forum rules!...
3,895
Posted By Don Cragun
I'm disappointed that you ignored my request for...
I'm disappointed that you ignored my request for clarity in the description of your problem again and still won't show us a sample of what you're trying to do.

If we assume that when you say you...
3,895
Posted By RudiC
You weren't too far off in your own attempt. Try,...
You weren't too far off in your own attempt. Try, after correcting the already commented on syntax errors and anchoring the regex at the line end,



sed 's/[^a-zA-Z|0-9]$/ /; s/ */ /g' file
3,895
Posted By nezabudka
Hi, rakeshp Try this. Will only delete the last...
Hi, rakeshp
Try this. Will only delete the last one
sed 's/[^\w]$//'
or. Will delete range of last characters
sed 's/[^\w]\+$//'
3,895
Posted By nezabudka
Bad idea to use sed and awk together. Try this ...
Bad idea to use sed and awk together. Try this
awk 'BEGIN {FS="|"; OFS="|"} {sub("[^[:alnum:]]$", ""); gsub("[^[:alnum:]]", "", $15)} 1'
9,977
Posted By Don Cragun
If the input file has a lot more than 89 records,...
If the input file has a lot more than 89 records, you might also want to try:
awk 'NR==23;NR==89{print;exit}'
to avoid reading the rest of the file after line/record 89.
9,977
Posted By MadeInGermany
Yout can do this with two commands awk 'NR==23;...
Yout can do this with two commands
awk 'NR==23; NR==89'
or with a logical or
awk 'NR==23 || NR==89'
This is the short condition{action} form where the default action is print.
Showing results 1 to 9 of 9

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