Skip to main content

Shell Script - Filter / Extract Lines {Quick & Dirty}

Hey!

Recently ran into a unique problem - had a csv file that was too large to open! 

Well technically.....it opened....but.....all of the data couldn't be displayed. Then I remembered I had a linux box I use for exactly this type of thing! 

Whipped up a quick & dirty script below. It reads the entire csv file, matches the lines that meet the specified criteria, and writes those line items into a new csv file. 

May not be the best or most efficient, but it works.


See script below:

#!/bin/bash

input_file="data.csv"

output_file="filtered.csv"

# Print header and then matching lines

(head -n 1 "$input_file" && grep "Call Data" "$input_file") > "$output_file"

echo "Done. Header and matched lines saved to $output_file."


Remember... chmod +x 

Comments

Popular posts from this blog

How I Used ChatGPT’s Voice Feature to Level Up My Spanish Speaking

Learning a language can sometimes feel like wandering in the dark—especially when you don’t have someone beside you pointing out missteps or celebrating small victories. Last year, I discovered a game-changer: ChatGPT’s built-in voice feature. In this post, I’ll walk you through how I used voice interactions with ChatGPT to evaluate my Spanish speaking level, share the feedback I received, and give practical tips for fellow B1–B2 learners who want to take their oral skills to the next level. Why I Turned to AI Voice Chat for Language Practice By April 2025, I’d already spent months studying Spanish through apps and textbooks, but I still felt stuck at a plateau. My writing and comprehension were decent, but as soon as I tried to speak fluidly—especially beyond simple topics—I hesitated, stumbled over the subjunctive, and felt my vocabulary desert me. I needed real-time conversation practice, plus objective feedback on pronunciation, fluency, and grammar—exactly what an official DELE ...

Using Data for Smarter SBC Configurations

In today's dynamic network landscape, managing Session Border Controllers (SBCs) can often feel like a game of guesswork—until you harness the power of data. In this post, I'll share insights on how leveraging real-time data transforms your approach to SBC configurations, boosting performance, enhancing security, and reducing costs. Once more, these are based on my experiences so please 'take with a pinch of salt!' Understanding the Role of SBCs For those new to the concept, SBCs are critical components in managing VoIP traffic and ensuring secure, seamless communication across networks. They handle everything from call setup to security, acting as a gatekeeper for your communication systems. However, configuring them without a solid understanding of your network's behavior can lead to inefficiencies and vulnerabilities. The Data-Driven Revolution Traditionally, SBC configurations have relied on static settings and educated guesses. But why settle for assumption...