At some point I'll turn this into something more useful but for now it's just so I don't lose it
docker inspect -f '{{ .Mounts }}' containerid
echo -l /bin | xargs ls -l
(will used STDOUT as parameter)
ls -1|grep -v "XMLFindAndReplace"|xargs -I {} mv {} ./.git/
chown root:root file1
(Sets OWNER:GROUP of file1)chmod g+rw file1
(add group RW to file1, can use octal i.e. 777 will be RWE for all, 700 will be RWE for user and none for other)find ./ -iname "*.txt"
(-type d = search for folders)grep -rli --include="*.js" "var SIM" ./*
(r = recursive , l = return file names, i = case insensitive)grep -ioP '<[lm].*?".*?"' ./IDs.txt
sed -e 's/ //g' -e 's/id="/:/g' -e 's/<//g' -e 's/\"//g' | sort -u
find ./ -iname "*pendemo*" | xargs -I {} rename 's/pendemo/xyz/g' {}
grep -rli "pendemo" ./* | xargs -I {} sed -i 's/pendemo/mellon/g' {}
grep -rli "Pen Demo Pension Scheme" ./* | xargs -I {} sed -i 's/Pen Demo Pension Scheme/XYZ Retirement Benefits Plan/g' {}
SELECT COLUMN_NAME AS 'ColumnName'
, TABLE_NAME AS 'TableName'
, 'SELECT ' + table_name + ', ' + column_name + ', COUNT(*) FROM [' + TABLE_NAME + '] where [' + COLUMN_NAME + '] = 22377;'
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%UNO%'
ORDER BY TableName
, ColumnName;
select distinct [Table Name] = o.Name, [Found In] = sp.Name, sp.type_desc
from sys.objects o inner join sys.sql_expression_dependencies sd on o.object_id = sd.referenced_id
inner join sys.objects sp on sd.referencing_id = sp.object_id
and sp.type in ('P', 'FN', 'V')
where o.name in ('tab_CMSOPENclient','tabTabsClient', 'vewtabTabsClient', 'vewHKRptClientListsForHAWKandCMSOpen', 'sp_RefreshTaBsClient')
order by sp.Name
SELECT sys.objects.object_id, sys.schemas.name AS [Schema], sys.objects.name AS Object_Name, sys.objects.type_desc AS [Type]
FROM sys.sql_modules (NOLOCK)
INNER JOIN sys.objects (NOLOCK) ON sys.sql_modules.object_id = sys.objects.object_id
INNER JOIN sys.schemas (NOLOCK) ON sys.objects.schema_id = sys.schemas.schema_id
WHERE
sys.sql_modules.definition COLLATE SQL_Latin1_General_CP1_CI_AS LIKE '%{Column Name}%' ESCAPE '\'
ORDER BY sys.objects.type_desc, sys.schemas.name, sys.objects.name
DECLARE @TableList TABLE(TABLE_NAME varchar(128))
DECLARE @Table varchar(128)
DECLARE @ColumnList TABLE(COLUMN_NAME varchar(128))
DECLARE @Column varchar(128)
DECLARE @Count int, @TableCount int, @i int
DECLARE @Search varchar(128)
DECLARE @SQL nvarchar(max)
SET NOCOUNT ON;
set @Search = 'Bespoke Team 1'
INSERT @TableList
select table_name from information_schema.tables where table_name like '%rpt%' and table_type = 'VIEW'
SELECT @TableCount = COUNT(*) From @TableList
SET @i = 0
WHILE(1 = 1)
BEGIN
SET @Table = NULL
SELECT TOP(1) @Table = table_name
FROM @TableList
SET @i = @i + 1
PRINT CONCAT('Table ', @i, '/', @TableCount)
IF @Table IS NULL
BREAK
/* Column Loop */
INSERT @ColumnList
select COLUMN_NAME from information_schema.COLUMNS where table_name = @Table and data_type in ('varchar', 'nvarchar') and column_name not in ('Scheme', 'Action', 'Insurer')
WHILE(1 = 1)
BEGIN
SET @Column = NULL
SET @Count = 0
SELECT TOP(1) @Column = Column_name
FROM @ColumnList
IF @Column IS NULL
BREAK
--SET @SQL = CONCAT('SELECT @COUNT = COUNT(*) FROM ', @Table, ' WHERE ', @Column , ' like ''%', @Search, '%'' ')
SET @SQL = CONCAT('SELECT @COUNT = COUNT(*) FROM [', @Table, '] WHERE [', @Column , '] = ''', @Search,''' ')
EXEC sp_EXECUTESQL @SQL, N'@Count INT OUTPUT', @count OUTPUT
IF @Count > 0
PRINT CONCAT('*****', @Table, ' - ', @Column , ' - ', @Count)
DELETE TOP(1) FROM @ColumnList
END
/* End Column Loop */
DELETE TOP(1) FROM @TableList
END