10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am getting the varible value from a grep command as:
var=$(grep "Group" File1.txt | sed 's/Group Name*//g;s/,//g;s/://g;s/-//g')
which leaves me the value of $var=xyz.
now i want to append $var value in the begining of all the lines present in the file. Can u please suggest?
Input file:
1... (10 Replies)
Discussion started by: rade777
10 Replies
2. Shell Programming and Scripting
Hi,
I have a shell script, which reads a *.txt file - line by line. In this text file, I have some lines beginning with "#" that I want to ignore :
MY_FILE
#blah blah blah 1
blah blah blah 2
blah blah blah 3
#blah blah blah 4
I want my script to read only the following lines... (3 Replies)
Discussion started by: ad23
3 Replies
3. Shell Programming and Scripting
Hi,
i am having one text file it contains some blank lines and i want to ignore that blank lines .
#! /bin/bash
clear
rdCount=0;
while read myline
do
echo $myline
let rdCount=$rdCount+1
done < ps.txt
echo "Total line=$rdCount"
and ps .txt contains the data- (17 Replies)
Discussion started by: aish11
17 Replies
4. Shell Programming and Scripting
I am having 6 files named file1,file2....file6 and i need to append number of lines in each file to begining of the file. For example,
If file 1 contains
a
b
c
d
then after adding new line file1 should contain
4
a
b
c
d
Thanks in advance. (2 Replies)
Discussion started by: akhay_ms
2 Replies
5. Shell Programming and Scripting
I am trying to print those line which has no # in the begining of the line.
The sed I used for this purpose as shown below is not giving the required output.
echo 'PDE 5600' | sed -n 's/^\!#/&/p'
Where lies the problem:confused: (3 Replies)
Discussion started by: hiten.r.chauhan
3 Replies
6. Shell Programming and Scripting
Hi all,
I'm looking for a way to generate an error when a command does not print an expected message. For example :
test.sh :
echo hi!test.exp :
exp_internal 1
spawn ./test.sh
expect {
"hi!" {puts "bingo!"}
"*" {puts "error!" ; exit 1}
}
I expected test.exp to match the string... (2 Replies)
Discussion started by: whbos
2 Replies
7. Shell Programming and Scripting
Hello Experts,
I have two files called "old" and "new". My old file contains 10 lines and my new file contains 10 + "n" lines.
The first field in both these files contain ID. I sort these two files on ID. I am interested in only the lines that are in the new file and not in old.
I tried... (4 Replies)
Discussion started by: forumthreads
4 Replies
8. Shell Programming and Scripting
Is there a way to tell awk to ignore the first 11 lines of a file?? example, I have a csv file with all the heading information in the first lines. I want to split the file into 5-6 different files but I want to retain the the first 11 lines of the file.
As it is now I run this command:
... (8 Replies)
Discussion started by: trey85stang
8 Replies
9. Shell Programming and Scripting
Is there a standard way to make a shell script read a file, or list, and skip each line that contains # at the begining, or ignores the content starting after a # in line?
I'm looking to mimic the way commenting in a shell script normally works. This way I can comment my text files and lists my... (4 Replies)
Discussion started by: sysera
4 Replies
10. Shell Programming and Scripting
Hi
I use sed in a script for severall changes in files. I whish one of the substitutions I made to be aplied to every line that has the word "scripts" with the exception for the ones that start with "rsh", wich I wish sed to ignore . Is this possible? If yes, how can I do it?
The substitution... (2 Replies)
Discussion started by: Scarlos
2 Replies