Jump to content

bigjim

Members
  • Posts

    2
  • Joined

  • Last visited

bigjim's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. bigjim

    preg_grep

    Thanks for the info. Already turned in the assignment using the system grep function but will try this when I get the time.
  2. bigjim

    preg_grep

    I am a student in a Linux class. I need to be able to search for lines within a file for certain text. The script I have written runs but delivers an empty array. I know the /etc/crontab file has the word "test" but I can't seem to get this to work properly. This is not my finished work, I just need to get the preg_grep function working before I can go any further.SCRIPT#! /usr/bin/php<?php fwrite(STDOUT, "Enter the name of the file you wish to open \n");$file = array(trim(fgets(STDIN)));$grepfile = preg_grep ( "/test/" , $file );print_r($grepfile);?>OUTPUTbigjim3@bigjim3-desktop:~$ ./assign4.phpEnter the name of the file you wish to open /etc/crontabArray()bigjim3@bigjim3-desktop:~$ Thoughts, Suggestions, Hints?TIA
×
×
  • Create New...