logo
down
shadow

Finding all .c files in linux using grep


Finding all .c files in linux using grep

By : user2949074
Date : November 16 2020, 06:23 AM
it fixes the issue I have an assignment to specify a linux command in a terminal that finds all the .c files on the system and the file name contains "lab" at the start (in all combinations of case sensitivity), followed by any number within 1-299 range ,followed by the character #, % or &. Example : lAb72# For the first part,I know that the command grep -i ignores the case sensitivity. , This should work for you:
code :
find . | egrep "[lL][aA][bB][1-2][0-9][0-9][%&#]\\.c$"


Share : facebook icon twitter icon
Finding executable files using ls and grep

Finding executable files using ls and grep


By : user3661102
Date : March 29 2020, 07:55 AM
like below fixes the issue I have to write a script that finds all executable files in a directory. So I tried several ways to implement it and they actually work. But I wonder if there is a nicer way to do so. , Do you need to use ls? You can use find to do the same:
code :
find . -maxdepth 1 -perm -111 -type f
ls -lsa | grep -E "[d\-](([rw\-]{2})x){1,3}"
finding line number of file using grep command Linux

finding line number of file using grep command Linux


By : p. mwangi mugo
Date : March 29 2020, 07:55 AM
should help you out I have to find the 250th line of a txt file that does not have a comma using the grep command. The file has more than 250 lines, but I have to find to 250th line that does not. , Unfortunately, posix disagrees:
code :
$ man grep
# ...
-n, --line-number
  Prefix each line of output with the 1-based line number within its input file.  (-n is specified by POSIX.)    
# ...
$ grep -v , text.txt | awk '{ if (NR == 250) { print } }'
Finding strings in a file using regex and grep in Linux

Finding strings in a file using regex and grep in Linux


By : user3358957
Date : March 29 2020, 07:55 AM
will be helpful for those in need A) Find all occurrences of words in text that have a substring ad, bd, cd, dd, ed.
code :
grep -ow '.*\(a\|b\|c\|d\|e\)d.*' text
egrep -ow '.*(a|b|c|d|e)d.*' text
grep -ow '[1-9][0-9][0-9]\+' text
grep -ow '[1-9][0-9][0-9]\+' text | grep '\(0\|5\)'
grep -ow '[1-9][0-9][0-9]\+' text | egrep '(0|5)'
Linux grep and sort log files

Linux grep and sort log files


By : Safak Gokcen
Date : March 29 2020, 07:55 AM
hop of those help? I looked almost everywhere (there, there, there, there and there) with no luck. , Try this:
code :
grep --color=always "myID" file*.log | sort -t : -k2,2 -k3,3n -k4,4n
file3.log:2015-09-26 15:39:48,788 - ERROR - bar : {'id' : myID}
file1.log:2015-09-26 15:39:50,788 - DEBUG - blabla : {'id' : myID}
file2.log:2015-09-26 15:39:51,788 - ERROR - foo : {'id' : myID}
Finding files with both of two specified terms via git grep

Finding files with both of two specified terms via git grep


By : michael mhike
Date : March 29 2020, 07:55 AM
With these it helps Two ways to achieve the goal:
1) combining multiple patterns specified by -e option with --and flag
code :
git grep -l -e 'term1' --and -e 'term2'
git grep -l --all-match -e 'term1' -e 'term2'
Related Posts Related Posts :
  • How to change the apache httpd port for serving files
  • Installing Patches in linux
  • Comparative analysis between libkvm on linux and NetBSD
  • How to join multiple txt files into based on column?
  • setting LINK variable in Makefile generated by qmake (5.0)
  • Automake - difficulty with installing version 'automake-1.14.1'
  • How to use Linux Network Namespaces for per processes routing?
  • How can I write a Gruntfile with different shell command behaviour for OS X vs. Linux?
  • Using at command in shell script for scheduling a command
  • Is there a method to figure out the audio channel layout in Linux?
  • Setting environment varilable for daemon / root process
  • string replacement in shell script
  • Add specific column to the end of a CSV file
  • Are there programmable automount/autofs hooks in linux/systemd?
  • Renaming files like 20141207_190822.jpg to "2014-12-07 19.08.22.jpg" in linux or MacOS X
  • undocumented kernel boot parameter?
  • using wget to mirror a website with path and subfolder that have the same name
  • Using awk to find data matching date range in text file
  • Installing xorg-x11-devel package in SLES 11 SP2
  • Setting result of find to variable, which has variables within it
  • Maximum/Minimum physical address - Linux kernel
  • Freepbx custom context outbound route
  • memcpy implementation in linux kernel
  • How to reverse a list of words in a shell string?
  • Concatenate and pass as parameter in bash
  • Add user to Docker container
  • How to add a content in a file in linux without opening the file using vi or cat command
  • Which SVN subversion can I use on linux, Mac, Windows?
  • Work with ZIP archive at Bash
  • bash script not running as expected from cron vs. shell.
  • Compare one field, Remove duplicate if value of another field is greater
  • sudoers NOPASSWD: sudo: no tty present and no askpass program specified
  • How do I use pipes and variable substitution in a shell script (for toggling haproxy active server)?
  • Linux/Unix Find Command
  • Not able to copy data in hdfs with hdfs dfs commands
  • Linux : Remove/Delete .txt files ending with exactly five digits
  • ARM assembly "retne" instruction
  • Migrate from LXC to LXD
  • sbt on linux not accepting -jvm-debug 5005
  • Supervisord events only sent to one eventlistener in pool
  • Extract part of a file name in bash
  • Bash Script to Comment/uncomment lines in file
  • Linux audio control web alsamixer
  • Can't remove first two encode characters using text editors in linux
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org