Search Results

Search: Posts Made By: St.Fartatric
3,262
Posted By St.Fartatric
guys rep pls!!! i hv one more prob.. now...
guys rep pls!!!


i hv one more prob.. now this is another simple stuff tht i m stuck wid..

i wanna use grep in a if-else statement... but thrs a prob here

if [ !( grep -q pattern1 MyFile) ...
3,262
Posted By St.Fartatric
thnx.. but 1 more thing.. '\n' doesnt work...
thnx..

but 1 more thing.. '\n' doesnt work gives the new line data in the same line..

sed "/pattern/ s/$/\nNew Row/" file

output
old data1
old data2
old data3
old data4
old data5
old...
3,262
Posted By St.Fartatric
i got this err.. > sed -i "/pattern/...
i got this err..

> sed -i "/pattern/ s/$/\nNew Row/" filesed: illegal option -- i
Usage: sed [-n] Script [File ...]
sed [-n] [-e Script] ... [-f Script_file] ... [File ...]

help me...
3,262
Posted By St.Fartatric
How to use a variable in sed
i wanna insert a row in a file.

I m using this command to insert a row in the 13th line.
sed '13i\
NewRow' MyFile > temp.txt
mv temp.txt to MyFile

this works fine.
now i wanna get the line...
37,906
Posted By St.Fartatric
adding or subtracting days in the o/p of date
how can we add or subtract days from the output of date command in unix...

like if i want to subtract a day from the result of date command like this..
v_date=`date +%Y%m%d`
this wud give me...
105,629
Posted By St.Fartatric
thnx man!!!
thnx man!!!
105,629
Posted By St.Fartatric
How to grep only 1st line
how to grep the line no of the first pattern match in a file having multiple line of pattern match.

linke i want to know the line no for the word "the" the first time it appears in the file, now...
2,788
Posted By St.Fartatric
thnks man.. it helped
thnks man.. it helped
2,788
Posted By St.Fartatric
Shell variable with awk
line_no=6
echo 'Phone,' `awk 'NR==$line_no{print;exit}' <filename>`

what is the error in this..

it says..
awk: Field $() is not correct.

The input line number is 1. The file is...
Showing results 1 to 9 of 9

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