3
votes
3answers
268 views

Year Month day from file name in shell script

I hava file names like below adn_DF9D_20140515_0001.log adn_DF9D_20140515_0002.log adn_DF9D_20140515_0003.log adn_DF9D_20140515_0004.log adn_DF9D_20140515_0005.log adn_DF9D_20140515_0006.log ...
0
votes
1answer
79 views

Changing Zone files with sed

I have this dns zone file I was unable to change the resource record type A to CNAME @ IN SOA ns1.domain.com. webdev.domain.com. ( 2006080101 ; serial 8H ; refresh 2H ...
0
votes
3answers
814 views

Remove a sentence which starts with word “mark” and ends with “;”

I am having 100's of files that contain sentence that starts with mark and ends with semicolon(;). eg: mark is driving a car; i need to remove every sentence starts with mark and end with ";" How ...
2
votes
2answers
1k views

How can I add a line break before a set of values going into a bash script?

I've got a set of data piping into a bash script. Here's an example of what that data looks like: "foo1": "Miscellaneous text", "foo2": "More text", "foo3": "blah blah blah", "foo4": ...
4
votes
4answers
5k views

Parse and convert ini into bash array variables

I'm trying to convert an ini file into bash array variables. The sample ini is as below [foobar] session=foo path=/some/path [barfoo] session=bar path=/some/path so these become ...
2
votes
5answers
538 views

How to remove a certain symbol for a bash script

I have a bash script where I get the disk usage, for example 60%. How can I remove the % symbol? Using grep or awk?
1
vote
3answers
454 views

Passing variables problem - Bash

I have a following problem: #!/bin/bash NUM=`cat accounts | wc -l`; for i in {1..$NUM} do account=`awk "NR==$i" accounts`; echo -e "\nAccount: $account\n"; sudo ./backup_maildir $account; ...
2
votes
3answers
374 views

Shell script to block proftp failled attempt

I want to filter and block failed attempt to access my proftp server. Here is an example line from the /var/log/secure file: Jan 2 18:38:25 server1 proftpd[17847]: spy1.XYZ.com ...
4
votes
5answers
1k views

Is it worth while to learn Awk?

I am decent with bash scripting and I am catching on to regex, and a little sed usage. Is learning awk still worth while with all the alternatives out there. Opinions?
1
vote
3answers
2k views

using awk in a bash script with if

I'm doing a script in which I need to test a string and based on its result I'll decide if I go further or not. The command below works fine (if the string starts with "Clean" it will print 1, ...