Skip to content

Instantly share code, notes, and snippets.

@davidvanvickle
Created December 17, 2012 19:52
Show Gist options
  • Save davidvanvickle/4321433 to your computer and use it in GitHub Desktop.
Save davidvanvickle/4321433 to your computer and use it in GitHub Desktop.
shell - loop file, make file with lines matching something
#! /bin/bash
# make a file with lines matching something
# usage: ./p.sh in.txt
while read line;
do
if [[ "$line" != *_S.jpg* ]]
then
echo $line >> a.txt
else
echo $line >> b.txt
fi
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment