Enhancement of unix script [closed]

Bash is not very performant doing loops. Since you tagged the question python, python should be ok? def data_mask(col_val): mod = len(col_val) + sum(map(ord, col_val)) % 10 result = “” for i, ch in enumerate(col_val, mod + 1): absnum = abs(ord(ch) – i) if ‘A’ <= ch <= ‘Z’: ch = chr(ord(‘A’) + absnum % … Read more

Iterating through a CSV and pulling out the last line of the day for each element

You can also consider using groupby If your data is already in this format: [ [‘CZ’, ’12/27/07 3:55 PM’, ‘1198788900’, ‘42345’, ‘42346’,], [‘CZ’, ’12/27/07 5:30 PM’, ‘1198794600’, ‘42346’, ‘42300’,], [‘CZ’, ’12/27/07 7:05 PM’,’1198800300′, ‘42300’, ‘42000’,], [‘JB’, ’12/27/07 7:05 PM’,’1198800300′, ‘13722’, ‘13500’,], [‘I’, ’12/27/07 7:05 PM’, ‘1198800300’, ‘4475’, ‘4572’] ] Then you can do this: #truncate … Read more

Some troubles with using sed and awk [closed]

From what we can discern of this question, you’re attempting to create a programmatic rule to rename files ending in extensions stdout-captured, stderr-captured, and status-captured (assuming one typo) into files ending in extensions stdout-expected, stderr-expected, and status-expected, respectively. Obviously, if each of these definitions is inclusive of exactly one file, a rote mv may be … Read more