AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/a/w/e/awebpaca/Dolibarr/dev/tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/a/w/e/awebpaca/Dolibarr/dev/tools//fixduplicatelanglines.sh
#!/bin/bash
# Recursively deduplicate file lines on a per file basis
# Useful to deduplicate language files
#
# Needs awk 4.0 for the inplace fixing command
#
# Copyright (C) 2016		Raphaƫl Doursenaud					<rdoursenaud@gpcsolutions.fr>
# Copyright (C) 2024		MDW							<mdeweerd@users.noreply.github.com>

exit_code=0

# Check arguments
if [ "$1" != "list" ] && [ "$1" != "fix" ]
then
	echo "Find exact duplicated lines into file (not cross file checking)"
	echo "Usage: $(basename "$0") [list|fix]"
	exit_code=1
fi

ACTION=$1

# To detect
if [ "${ACTION}" = "list" ] || [ "${ACTION}" = "fix" ]
then
	echo "Search duplicate lines for lang en_US"
	echo ""
	for file in htdocs/langs/en_US/*.lang
	do
		if [ "$(sort "$file" | grep -v -P '^#?$' | uniq -d | wc -l)" -gt 0 ]
		then
			sort "$file" | grep -v -P '^#?$' | uniq -d | awk '$0="'"$file"':"$0'
			exit_code=1
		fi
	done
fi

# To fix
if [ "${ACTION}" = "fix" ]
then
	echo "Fix duplicate line for lang en_US"
	# shellcheck disable=2016
	for file in htdocs/langs/en_US/*.lang ; do
		awk -i inplace ' !x[$0]++' "$file"
	done
fi

exit $exit_code

Anon7 - 2022
AnonSec Team