<jupyter_start><jupyter_text>**How To Filter Except Some Text In A File?**Here i filter line text except nologin<jupyter_code>!cat ~/Work/user.txt
%%bash

grep -P '^(?!.*nologin$)' ~/Work/user.txt
%%python3

from pathlib import Path
from re import search

fr = Path('/home/mana/Work/user.txt').read_text().splitlines()
print(*[i for i in fr if search(r'^(?!.*nologin$)', i)])<jupyter_output>mana:x:1000:1000:mana,,,:/home/mana:/bin/bash
{'fraction_non_alphanumeric': 0.1926605504587156, 'fraction_numerical': 0.020642201834862386, 'mean_word_length': 5.828125, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '97525', 'license': 'MIT', 'n_tokens_mistral': 186, 'n_tokens_neox': 172, 'n_words': 40, 'path': 'How-To-Filter-Except-Some-Text-In-A-File.ipynb', 'repo_name': 'ManavalanMicheal/Python-Bash', 'size': '436'}