
file_manipulation
List of commands for file_manipulation:
-
file_manipulation:warp:3dcc9 Recursively find and replace within a directory$ grep -rl ${old_text} ${file_path} | xargs sed -i '' 's/${old_text}/${new_text}/g'try on your machineexplain this command
-
file_manipulation:warp:42e78 Replace newline with a space in a file$ tr '\n' ' ' < ${file_name}try on your machineexplain this command
-
file_manipulation:warp:4ff5b Sort a file by line length$ cat ${file_name} | awk '{ print length, $0 }' | sort -n -s | cut -d" " -f2-try on your machineexplain this command
-
file_manipulation:warp:63a4e7ade76260ddef0e586180a62531 Insert a line at a specific line number$ sed -i '' '${line_number}i\
$ ${line_number} ${text}' ${file_name}try on your machineexplain this command -
file_manipulation:warp:b258ada17cb9a5d07cfcab2cde27931b Find all files in a directory that don't contain a string$ grep -L "${pattern}"try on your machineexplain this command
-
file_manipulation:warp:be41aa3050d444ffa85e681aa5962dc5 Delete all lines that contain a specific string from a text file$ sed -i '' '/${string}/d' ${file}try on your machineexplain this command
-
file_manipulation:warp:bf4fd Recursively search through files that match an extension$ grep -r --include=\*.${extension} '${search_term}' ${file_name}try on your machineexplain this command
-
file_manipulation:warp:d071fbbca6930a159e0a53c168b52ef7 Print the nth line of a file$ sed '${line_number}q;d' ${file_path}try on your machineexplain this command
-
file_manipulation:warp:d97df Sum all numbers in a file$ awk 'BEGIN {OFMT = "%.0f"} { sum += $1 } END { print sum }' ${file_name}try on your machineexplain this command
-
file_manipulation:warp:e6754b24398f1b178804d18fadc5c82b Delete empty lines in a file$ sed '/^[[:space:]]*$/d' ${file_name}try on your machineexplain this command
-
file_manipulation:warp:eef3b Remove the first line of a text file$ tail -n +2 "$${file_name}"try on your machineexplain this command