Created
          October 14, 2024 07:43 
        
      - 
      
 - 
        
Save DaWe35/6746408768c66eb57ef29bd160f459d7 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
DaWe35 created this gist
Oct 14, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/bin/bash # Input and output files input_file="input.txt" output_file="output.txt" # Initialize line counter line_counter=0 # Remove output file if it exists > "$output_file" # Read the input file line by line while IFS= read -r line do # Increment the line counter line_counter=$((line_counter + 1)) # If line is 3rd in the group, write it to the output file if (( line_counter % 4 == 3 )); then echo "$line" >> "$output_file" fi # Reset the counter after every 4 lines if (( line_counter % 4 == 0 )); then line_counter=0 fi done < "$input_file" echo "Finished processing the file. Output saved in $output_file."