Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: edit.sh

Issue 29761555: #8852 - ldap sync output filter (Closed)
Patch Set: #8852 - ldap sync output filter Created May 14, 2018, 3 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/sh
2 #####################################################################
3 #####################################################################
4 ## The cause of this script is to make the output of the LDAP ##
5 ## sync cron job more readable by filtering all repeated lines ##
6 #####################################################################
7 #####################################################################
f.lopez 2018/05/15 00:51:19 "Filters out repeated lines from LDAP sync cron jo
8
9 last_updated=""
10
11 while IFS= read -r line; do
f.lopez 2018/05/15 00:51:19 This IFS set is redundant here because you are quo
12 if echo "$line" | grep -q "Updating" ||
f.lopez 2018/05/15 00:51:19 can't you avoid repeating yourself here with the `
13 echo "$line" | grep -q "Creating"
14 then
15 last_updated="$line"
16 fi
17
18 if echo "$line" | grep -q -v "Updating" &&
f.lopez 2018/05/15 00:51:19 You can use the `-F` flag for all lines so you don
19 echo "$line" | grep -q -v "Creating" &&
20 echo "$line" | grep -q -v "Found" &&
21 echo "$line" | grep -q -v "#" &&
22 echo "$line" | grep -q -v "Synchronizing" &&
23 echo "$line" | grep -q -v -F -e "->"
24 then
25 echo $line
f.lopez 2018/05/15 00:51:19 my editor shows an empty space at the end of this
26 fi
27
28 if echo "$line" | grep -q -F -e "->"
f.lopez 2018/05/15 00:51:19 no need for `-F` flag since you are matching a sin
29 then
30 echo $last_updated
31 echo $line
f.lopez 2018/05/15 00:51:19 Quote both lines here http://www.tldp.org/LDP/abs
32 fi
33 done
f.lopez 2018/05/15 00:51:19 add an empty line at the end of the file
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld