Search Results

Search: Posts Made By: BundBash
95,468
Posted By BundBash
no am learning bash scripting for a new...
no am learning bash scripting for a new job.....it's not homework
95,468
Posted By BundBash
yes franklin but I need to carry it out using...
yes franklin but I need to carry it out using only a while loop and no use of the sed or awk commands.....
95,468
Posted By BundBash
@Anchal - Many thanks I got it working using the...
@Anchal - Many thanks I got it working using the found variable but I have been told there is a way using just the while loop.....


@Franklin - input file is "env" command's output. Am unable...
95,468
Posted By BundBash
yy=$1 and yes its in the current directory. Here...
yy=$1 and yes its in the current directory. Here is the complete code:




#!/bin/bash

yy=$1
count=1



while read line
do

found=$(grep $USER $line)
if [ "$found" ];...
95,468
Posted By BundBash
@ anchal yes i want to search for every time...
@ anchal

yes i want to search for every time $USER is in the yy file and write output in the form:

1) data
2) data
3) data

etc

I see what you have done and I understand the code but...
6,394
Posted By BundBash
Thanks, I tried that and it makes sense now..... ...
Thanks, I tried that and it makes sense now.....

Was thinking....would separating the filename in brackets allow you to not include the filename??
95,468
Posted By BundBash
While read line loop
Hi I'm writing a bash script which will read an input file and look for occurrences of the current user ($USER) executing the script. When i find the occurrence of the username I take that line and...
6,394
Posted By BundBash
Thanks Scrutinizer.....that is working...
Thanks Scrutinizer.....that is working great.....can u briefly explain why you add a < so i can understand......am a new starter :rolleyes:
6,394
Posted By BundBash
Adding Text To Middle Of File
Hi I am trying to write a bash script to add a line of text to the middle of a file.

The way I worked it out was to calculate the number of lines and divide by 2. The file I am using is called...
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 07:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy