05-04-2008
retrive lines from a file using AWK command
Dear friends,
please tell me how to get some required lines from a file and write to another file using AWK command.
i.e.,
if a file contains,
abcdefghigk
12345
lmnopqrstuv
678910
wxyz
please tell me how to get lines(line count is always 2 and it's contineous) mentioned in blue colour from above file and write the same to another file.
thanks in advance,
swamymns
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can u see the code below.
set xyz = `cat testt1.txt | awk '/-----/{\
print $1 }\
' | tail -1`
I need to execute it in c shell . What is wrong with the above command.
When i write everything on a single line then it is working.
Can anybody help me . (0 Replies)
Discussion started by: nani_g
0 Replies
2. Shell Programming and Scripting
hi
i have following file.
where i m trying to retrive data on latest date.
let us say we are extracting data from this file for Jun 30 where date is highest date in log file.
here i want to take output in other file from first line of Jun 30 to the end of file
in short i want retrive... (5 Replies)
Discussion started by: d_swapneel14
5 Replies
3. UNIX for Advanced & Expert Users
I have shell script which reads files, stores its data into Oracle and then deletes tht file.
now i want to know creation date and time of deleted files.
can we do this? if yes then how? (4 Replies)
Discussion started by: asmita
4 Replies
4. Shell Programming and Scripting
hi,
I need to get the list of functions that are used more than once in a file
list. Thanks in advance (1 Reply)
Discussion started by: anibu
1 Replies
5. Shell Programming and Scripting
hi
i am new to shell scripting
i have a properties file like
hs=abc
hs1=def
hs2=ghi
now i want to retrive each value and assign it to a variable
like var1 = abc
please help (7 Replies)
Discussion started by: satish@123
7 Replies
6. Shell Programming and Scripting
Hello Everybody,
I'm facing a weird problem with the awk command.
I try to retrieve in a variable the value returned by a simple ls command.
ls /export/home/tmp |tail -1 return a good value (the name of the .
But When I try to execute the same command in a remote server using ssh as... (2 Replies)
Discussion started by: Jabarod
2 Replies
7. Shell Programming and Scripting
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies
8. Shell Programming and Scripting
Hi,
I have a file with date in it like:
UserString1
UserString2
UserString3
UserString4
UserString5
I need two entries for each line so it reads like
UserString1
UserString1
UserString2
UserString2
etc. Can someone help me with the awk command please?
Thanks (4 Replies)
Discussion started by: Grueben
4 Replies
9. Shell Programming and Scripting
Hello,
Am trying to print three lines in a single line using AWK getline command.
Below is the command am trying and its displaying only two lines in a single line.
Command:
awk '{getline n; printf($0,t);next}'
Can you please help me ?
Thanks,
Prince (1 Reply)
Discussion started by: prince1987
1 Replies
10. Shell Programming and Scripting
I have a below file
FILE.cfg
JAN_01
VAR1=4
VAR2=SUM
VAR3=PRIVATE
JAN_10
VAR1=44
VAR2=GUN
VAR3=NATUR
JAN_20
VAR1=3
VAR2=TQN
VAR3=COMMA
code: (JAN_10 is argument passed from script) (6 Replies)
Discussion started by: Roozo
6 Replies