Skip to content

Commit

Permalink
Added snippet for removing line with last php closing tag
Browse files Browse the repository at this point in the history
  • Loading branch information
apmuthu committed Jul 11, 2024
1 parent a1a1231 commit d28dae3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,20 @@ grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' log.txt | sort
find . -type f \( -name "*.png" -o -name "*.jpg" \) -exec bash -c 'base64 {} > {}.b64' \;
```

## [Regex Replace for Date format in Notepad++](https://stackoverflow.com/questions/11880516/how-to-get-date-format-in-notepad) ##
## [Regex Replace for Date format in Notepad++](https://stackoverflow.com/questions/11880516/how-to-get-date-format-in-notepad)
* dd/mm/yyyy format to be reeplaced as yyyy-mm-dd format using RegEx Replace option
* '11/04/2011', needs to become '2011-04-11'
* Find: `(\d+)/(\d+)/(\d{4})` Replace with: `$3-$2-$1`

## PHP

### [Remove last php closing tag](https://stackoverflow.com/questions/56478233/remove-closing-php-tags-from-all-files)
```bash
sed '${/?>/d;}' -i my_php_script.php
# Recursive within a folder:
cd /your/dir/here && find . -type f -print0 | xargs -0 sed -i '${/?>/d;}'
```

### Debugging by append marker (AA here) to log file
```php
$a = file_put_contents('./logs.txt', date('Y-m-d ')."AA".PHP_EOL , FILE_APPEND | LOCK_EX);
Expand Down

0 comments on commit d28dae3

Please sign in to comment.