Search Results

Search: Posts Made By: siteregsam
1,093
Posted By Yoda
echo 160845 | sed 's/\(..\)\(..\)/\1:\2:/' ...
echo 160845 | sed 's/\(..\)\(..\)/\1:\2:/'
16:08:45
13,130
Posted By pludi
mv *20120308* is translated by the shell (in your...
mv *20120308* is translated by the shell (in your case) to mv XXX_20120308.tar.Z XXX_20120308_COMPLETE due to shell expansion. So the .Z file is moved/renamed to XXX_20120308_COMPLETE, overwriting...
1,114
Posted By Scott
Everyone at the UNIX and Linux Forums gives their...
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and...
4,877
Posted By Corona688
Or just ((i++))
Or just ((i++))
4,877
Posted By codemaniac
Hello Bala , In addition to your solution ,...
Hello Bala ,

In addition to your solution , i would like to add the increment part of index , can also be done below .

((i+=1))
4,877
Posted By balajesuri
#! /bin/bash i=0 for x in /home/sam/*.dat ...
#! /bin/bash
i=0
for x in /home/sam/*.dat
do
arr[$i]=$x
i=$(($i+1))
done
echo ${arr[@]}
3,692
Posted By ctsgnb
sed '/|$/!d;s:.*/::;s:|$::' infile$ cat tst ...
sed '/|$/!d;s:.*/::;s:|$::' infile$ cat tst
PDEWG511_TVLI_JOB_STATS.ksh.20120214_1331.log:nazeer|Wed Feb 15 13:28:04 ...
3,692
Posted By Scrutinizer
Or put all commands in one awk: awk -F'[/|]'...
Or put all commands in one awk:
awk -F'[/|]' '/C10_Subscribe.000\|subscribe\|newfile\|/{print $(NF-1)}' infile
3,692
Posted By kalpeer
Just modified your command little, ...
Just modified your command little,



Output:


Whats your platform ? uname -a
3,692
Posted By kalpeer
When i execute your command i am getting the...
When i execute your command i am getting the below output.

Its not mandatory to have file for awk.

Is this is the expected output ?

Thanks,
Kalai
2,057
Posted By Scrutinizer
The syntax is correct. Are the variables set...
The syntax is correct. Are the variables set correctly? Try putting double quotes around $fn and $bd_file. Are you on Solaris? If so use /usr/xpg4/bin/awk
2,057
Posted By Peasant
I'm unable to replicate error using gawk. ...
I'm unable to replicate error using gawk.

Can you hardcode the fn"bad_data" as "fn_bad_data"
That should create fn_bad_data file when ran.

If that works, make a another variable with -v like...
1,979
Posted By itkamaraj
your sed is not supporting the -i option. ...
your sed is not supporting the -i option.

then you can redirect the output to new file.

sed '/^H|\|^T|/d' infile > outfile
1,979
Posted By guruprasadpr
sed '/^[HT]/d' file Guru.
sed '/^[HT]/d' file

Guru.
1,994
Posted By guruprasadpr
grep -c '|' file Guru.
grep -c '|' file

Guru.
1,994
Posted By balajesuri
Try this: grep -v "14$" inputfile.dat | wc...
Try this:
grep -v "14$" inputfile.dat | wc -l
7,908
Posted By itkamaraj
$ nawk -F\| '{if(NF>14){printf("%s\n",$0) >>...
$ nawk -F\| '{if(NF>14){printf("%s\n",$0) >> "a.txt"}else{printf("%s\n",$0) >> "b.txt"}}' input.txt

$ cat a.txt
a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|...
2,261
Posted By knight_eon
Lets say, you have some set of files ending with...
Lets say, you have some set of files ending with .dat and u want to create the Trailer like T|$(count-1)

So,


for fn in *.dat
do
awk 'END{print "T| " NR-1}' ${fn} >> ${fn}
done
2,261
Posted By venkatareddy
Hi, you can append to the file in the...
Hi,
you can append to the file in the following format

echo "T|$count " >>$fn.txt

incase if it needs to printed in new line

echo -e "\n T|$count " >> $fn.txt

thanks,
venkat
2,261
Posted By guruprasadpr
count=`wc -l $fn | awk '{print $1-1}'` echo...
count=`wc -l $fn | awk '{print $1-1}'`
echo "T|$count" >> $fn

Guru.
2,015
Posted By itkamaraj
ls -ltr input_*.dat | tail -1 | awk '{print $NF}'...
ls -ltr input_*.dat | tail -1 | awk '{print $NF}'

---------- Post updated at 10:09 AM ---------- Previous update was at 10:08 AM ----------

ls -ltr input_*.dat | nawk '{a=$NF}END{print a}'
2,015
Posted By itkamaraj
ls -1t highlighted is not l its 1...
ls -1t


highlighted is not l its 1 (numerica one)
2,015
Posted By balajesuri
If you're talking about the recently modified...
If you're talking about the recently modified file, then try this:
ls -1t input_*.dat | head -1
Showing results 1 to 23 of 23

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