Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
What single command line would you enter to get the following output?
(The tricky part.. the code must include the "/../" in the output. In other words, special parameters are required. 2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Arizona State University, Tempe, ASU, Mazzola, CIS 494
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Reference the sample directory listing in post #1 section 1.
Interestingly all the directories have the same inode number (the first field) but you would only find the first directory with a find /filesystem -xdev -inum 8140 command because "find" ignores the ".." directory.
The links count is 9 when you would expect it to be 6, therefore there are 3 more directories with this inum somewhere.
We can forget using the inode number.
The sample directory listing is not in alphabetic order. There is no single "ls" command which could produce this output ... unless perhaps there is a hidden timestamp and the "-t" parameter was used or you have a version of "ls" where you can turn off the sort.
The sample includes the path name in the file field. You can only get this from "ls" if you specified the path on the "ls" command line.
Therefore I think that the sample came from 6 individual "ls" commands.
For example:
Note: I don't have the same version of "ls" as you. If you haven't got "-p", then "-F" is just as good. I haven't got "-h" (human readable) at all.
I was wondering more: to what point do you call something you type at the prompt "single command line"...
For I dont get how it is possible to display the 2 first lines with the following...
Unless you have find with fancy options we dont know...
Here are variants on ONE line:
Are you sure you understood with what we are to solve (just ls or find?...)?
Thrcky bit is not much /../ but to get / , /./ and /../ together in one pass... It has to do with th inode itself but its friday I am a bit tired... and lack of imagination at the time...
Last edited by vbe; 03-16-2012 at 02:50 PM..
Reason: typos
@vbe
Certainly agree with joining the commands with semi-colon to keep them on the same line, but I think that every directory has to be mentioned separately to achive the exact (unsorted) order of the sample in post #1 item 1.
... unless someone has another idea.
@methyl,
I missed that (did not notice the obscure unsorted... )You are right, specially when all points to the same directory... (so one timestamp ?)
Are we getting old and forgotten some obvious facts in relation with inodes???
What puts me off is that the layout is one of ls command... so it must be a construct finding what to ls...
I can't match it without using 6 separate "ls" commands. Unless there is some hidden order (like a timestamp) which was visible before the files got old.
I pass a number to my script. Passing "1" below.
./getfile.sh 1
echo "User entered: $1"
ls -ltr *.conf | sed -n '$p'
I wish to use ls -ltr i.e list files in ascending order of time the latest showing at the bottom of the output.
Number 1 should get me the last row of ls -ltr output i.e... (9 Replies)
This could be a really dummy question.
I have a log text file.
What unix command to extract line from specific string to another specific string.
Is it something similar to?:
more +/"string" file_name
Thanks (4 Replies)
lets say I am printing something out
echo "Please enter a valid username"
and its being printed out 5 times, is there any way I can limit to only being displayed ONCE. I tried echo -n but that just makes everything fit on one line.
Right now it keeps saying
Please enter a valid... (5 Replies)
Hi,
I'm trying to figure out a way to find which line in my file.txt with IP addresses:
192.168.0.1
192.178.0.2
etc...
returns specific result when I execute command affecting all lines.
For example when I run:
for line in `cat file.txt`;
do
snmpget $line
done
it displays the... (5 Replies)
This is Input - starts with Storage Group Name and ends with Shareable and the loop continues all I need is Storage group name and Alu numbers in the below output format requested.
Storage Group Name: abcd
Storage Group UID: 00:00:000:00:0:0:0
HBA/SP Pairs:
HBA UID ... (6 Replies)
Hi
I am facing a strange problem
a=03
echo ${a}
the output is 3
But i want to display it is 03
Can you people help me how to display it like 03.
Thanks (2 Replies)
Dear Friends,
I have my command output which displays on one row and values are now scrollable (vertical) 3 pages. How do i display those output in three column so that i no need to scroll?
Example:
dcadd$cat components
1.Caluculator
2.Diary
...
...
50.Mobile
51.Battery
..
...... (12 Replies)
are there any basic commands that can display lines 99 - 101 of the /etc/passwd file?
I'm thinking use of head and tail, but I forget what numbers to use and where to put /etc/passwd in the command. (2 Replies)
I have a variable that is outputting a lot of space.
here has been 45 lines returned ...
how can I remove the spaces between the "been and the 45"
CODE:
fil_len=`wc -l < coshb.txt`
if ; then
cat coshb.txt | more
echo " "
echo "There has been ${fil_len} lines... (4 Replies)